I am trying to create a hashmap that its keys are unique IDs and the value is the name of the squares found by reflection is.
My problem is to create those unique IDs. How can I be strong that each class has unique ID, and this ID will never change. I mean, if I create a new class, it will never replace old class ID.
UPDATE It guarantees to be completely unique But using the fully qualified class name should be enough. The full path of the Example Edit: If you need required , this is an integer, you can always use string hashod
I need that the ID will be an integer number. (Sorry I have not mentioned this: P) string , such as
java.lang.Math will be a good "unqiue" id, and should rarely be a hash collision.
map.put (MyClass.class.toString (), MyClass.class);
Map.put (MyClass.class.toString () .hashode (), MyClass.class);
No comments:
Post a Comment