StableHashMap & StableHashSet

These versions of HashMap and HashSet maintain the order of its elements upon insertion and deletion of its entries. This is different from the original Java 1.3 HashMap and HashSet classes that guarantees no order for its elements.

The order of the values in a StableHashMap or StableHashSet instance is stable and does not change during the lifetime of the object. Both classes also support removing a value from the order and putting it at the front or back of the collection in linear time. The methods that implement this feature are reorderToFront(Object) and reorderToBack(Object).

In the Java 1.4 API, the SortedMap interface and the implementing class TreeMap closely resemble our classes HashMap and HashSet.