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

gcc - MinGW's ld cannot perform PE operations on non PE output file -

How to connect android app to App engine -

hadoop - Running Map Reduce Job shows error - Mkdirs failed to create /var/folders/ -