I have;
List<String> stringList = new ArrayList<String>();
List<Integer> integerList = new ArrayList<Integer>();
Is there a (easy) way to retrieve the generic type of the list?
I have;
List<String> stringList = new ArrayList<String>();
List<Integer> integerList = new ArrayList<Integer>();
Is there a (easy) way to retrieve the generic type of the list?
You can do the same for method parameters as well:
The type is erased so you will not be able to. See http://en.wikipedia.org/wiki/Type_erasure and http://en.wikipedia.org/wiki/Generics_in_Java#Type_erasure