Java: Need a hash Map where one supplies a function todo the hashing
<p>I would like to know of a Map that works like a regular HashMap/Hashtable except it takes a function which returns the hashcode and performs the equality test rather than letting the HashMap use Object.hashCode/equals. </p>

<p>I cant use TreeMap because the objects do not implement Comparable and there is no stable way to handle the case of unequal objects. One cannot use System.identityHashCode because there is the potential for conflicts for objects that are not equal.</p>

<p>Ideally it would be great if the Map took a function in a similar way one can supply a custom Comparator to a TreeMap rather than letting the TreeMap cast parameters to Comparable.</p>

<p>The only way around this problem is to wrap each key and have the wrapper do the custom hashing/equals but surely therse a better way.</p>
