Is using the Class instance as a Map key a best practice?
- by Pangea
I have read somewhere that using the class instances as below is not a good idea as they might cause memory leaks. Can someone tell me if if that is a valid statement? Or are they any problems using it this way?
Map<Class<?>,String> classToInstance=new HashMap();
classToInstanceMap.put(String.class,"Test obj");