Originally posted by Paul McKenna:
HashMap m = new HashMap();
MyKey key = new MyKey(MyConstants.PRIMARY_KEY); // MyKey is just a wrapper class around a string constant
m.put(key, "Nothing here");
..
..
System.out.println("Value for mykey : "+key);// use the already defined key
..
..
Perhaps this might work, if Object.hashcode() is not overridden.
-GB.