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
Post a Comment