Consider the following 2 method declarations:
1. public abstract <T extends MetaData> List<T> execute();
2. public abstract List<? extends MetaData> execute();
Both seem to return back a list of objects that extend MetaData.
What is the difference between them please?
In the first case you will allow Java to use type inference and infer the type of
Tat each call site.In the second case you will always get a
List<? extends MetaData>and so won’t be able to assign it to a variable of any narrower type likeList<IntegerMetaData>.