Java: Return unknown generic type in method -


the method

filter<t,u> connect(final filter<t,u> filter) { ... return filter } 

is in class

class pipe<t> 

i error "cannot resolve u". idea generically return same filter same 2 types without knowing u type. how do that?

the goal able chain without providing type parameters, when not necessary because not modified:

(new pipe<integer>).connect(new filter<>(...)).connect(new pipe<>)... 

the second pipe after filter in above expamle shall implicitly of generic type integer.

it looks trying make method generic. add generic type u signature right before return type:

<u> filter<t,u> connect(final filter<t,u> filter) {     ...     return filter } 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -