I was wondering if there is a way in Java to do something like
Class c = List<String>.class; Class c2 = List<Date>.class;
I need something like this to create a map that stores the class name (with generic type) and the corresponding object which I can later lookup. For example,
Map<Class, Object> dataMap = new HashMap<Class, Object>(); dataMap.put(c, listOfStrings); dataMap.put(c2, listOfDates);
Is this not possible because of type erasure during runtime ?