java - Generic vs wildcard unknown types -


when recommended do:

public <e> boolean haspropertyx(list<e extends user> alist); 

versus

public boolean haspropertyx(list<? extends user> alist); 

it appear both work well.

without typed return value, difference can think of explicit typing of first way of declaration during method call.

so example using inside typed class c<k extends string>

list<v extends string> input = ...; boolean var = obj.hasproperty<k>(input); 

will raise compiler error. why 1 want so...

nice question if answer both same.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -