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 -

java - Could not locate OpenAL library -

Non Unique Username with ASP.Net Identity 2.0 -