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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -