public static <T> ArrayList<T> a()
In the first case <T>, a type parameter is entered that will be available within the method.
The actual type of return ArrayList<T>, where Tthe same as in the first.
You can read about it here - General Methods .
In the second:
public static <String> ArrayList<Vector> a() {
Even though you entered a parameter of a general type (i.e. String, which is not an actual type or argument, for example java.lang.String), you do not use it. And also the method always returns ArrayList<Vector>( ArrayListof Vectors).
source
share