Is there a way to check what class you passed to a parameterized function using something like instanceof? In some ways this kind of defeats the purpose (I get that), but I was wondering if something like this was possible.
public static <T> List<T> foo(String parseMe) {
List<T> lst = new ArrayList<T>();
if (T instanceof Type1) {
...
} else if (T instanceof Type2) {
...
} else {
...
}
return lst;
}