de.unkrig.commons.util.collections
Class IdentityLinearMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by de.unkrig.commons.util.collections.LinearMap<K,V>
          extended by de.unkrig.commons.util.collections.IdentityLinearMap<K,V>
Type Parameters:
K - The type of the map keys
V - The type of the map values
All Implemented Interfaces:
java.util.Map<K,V>

public final class IdentityLinearMap<K,V>
extends LinearMap<K,V>

An identity map (see IdentityHashMap) that performs very well for a SMALL number of entries.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
IdentityLinearMap()
           
 
Method Summary
protected  boolean keysEqual(java.lang.Object key1, java.lang.Object key2)
           
protected  boolean valuesEqual(java.lang.Object value1, java.lang.Object value2)
           
 
Methods inherited from class de.unkrig.commons.util.collections.LinearMap
clear, containsKey, containsValue, entrySet, get, isEmpty, put, remove, size
 
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, keySet, putAll, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IdentityLinearMap

public IdentityLinearMap()
Method Detail

keysEqual

protected boolean keysEqual(@Nullable
                            java.lang.Object key1,
                            @Nullable
                            java.lang.Object key2)
Overrides:
keysEqual in class LinearMap<K,V>
Returns:
Whether the two keys are equal in the sense of this map; can be overridden e.g. for an 'identity map'
See Also:
IdentityHashMap

valuesEqual

protected boolean valuesEqual(@Nullable
                              java.lang.Object value1,
                              @Nullable
                              java.lang.Object value2)
Overrides:
valuesEqual in class LinearMap<K,V>
Returns:
Whether the two values are equal in the sense of this map