java.lang.Object | +--org.apache.commons.collections.map.AbstractHashedMap | +--org.apache.commons.collections.map.AbstractLinkedMapAll Implemented Interfaces:
transient AbstractLinkedMap.LinkEntry | Header in the linked list |
Constructor only used in deserialization, do not use otherwise. |
AbstractLinkedMap(int initialCapacity, float loadFactor, int threshold) Constructor which performs no validation on the passed in parameters. |
AbstractLinkedMap(int initialCapacity) Constructs a new, empty map with the specified initial capacity. |
AbstractLinkedMap(int initialCapacity, float loadFactor) Constructs a new, empty map with the specified initial capacity and load factor. |
AbstractLinkedMap(Map map) Constructor copying elements from another map. |
void | addEntry(AbstractHashedMap.HashEntry entry, int hashIndex) Adds an entry into this map, maintaining insertion order. |
void | clear() Clears the map, resetting the size to zero and nullifying references to avoid garbage collection issues. |
boolean | containsValue(Object value) Checks whether the map contains the specified value. |
createEntry(AbstractHashedMap.HashEntry next, int hashCode, Object key, Object value) Creates an entry to store the data. | |
Iterator | Creates an entry set iterator. |
Iterator | Creates a key set iterator. |
Iterator | Creates a values iterator. |
Object | firstKey() Gets the first key in the map, which is the most recently inserted. |
getEntry(int index) Gets the key at the specified index. | |
void | init() Initialise this subclass during construction. |
Object | lastKey() Gets the last key in the map, which is the first inserted. |
Gets an iterator over the map. | |
Object | nextKey(Object key) Gets the next key in sequence. |
Gets a bidirectional iterator over the map. | |
Object | previousKey(Object key) Gets the previous key in sequence. |
void | removeEntry(AbstractHashedMap.HashEntry entry, int hashIndex, AbstractHashedMap.HashEntry previous) Removes an entry from the map and the linked list. |
protected transient AbstractLinkedMap.LinkEntry header
protected AbstractLinkedMap()
protected AbstractLinkedMap(int initialCapacity, float loadFactor, int threshold)
protected AbstractLinkedMap(int initialCapacity, float loadFactor)
- if the initial capacity is less than one
- if the load factor is less than zeroprotected AbstractLinkedMap(int initialCapacity)
- if the initial capacity is less than oneprotected AbstractLinkedMap(Map map)
- if the map is nullprotected void addEntry(AbstractHashedMap.HashEntry entry, int hashIndex)
public void clear()
public boolean containsValue(Object value)
protected AbstractHashedMap.HashEntry createEntry(AbstractHashedMap.HashEntry next, int hashCode, Object key, Object value)
protected Iterator createEntrySetIterator()
protected Iterator createKeySetIterator()
protected Iterator createValuesIterator()
public Object firstKey()
protected AbstractLinkedMap.LinkEntry getEntry(int index)
- if the index is invalidprotected void init()
public Object lastKey()
public MapIterator mapIterator()
public Object nextKey(Object key)
public OrderedMapIterator orderedMapIterator()
public Object previousKey(Object key)
protected void removeEntry(AbstractHashedMap.HashEntry entry, int hashIndex, AbstractHashedMap.HashEntry previous)
LinkEntry
class which can be overridden and replaced. The iterators can similarly be replaced, without the need to replace the KeySet, EntrySet and Values view classes. Overridable methods are provided to change the default hashing behaviour, and to change how entries are added to and removed from the map. Hopefully, all you need for unusual subclasses is here. This implementation maintains order by original insertion, but subclasses may work differently. TheOrderedMap
interface is implemented to provide access to bidirectional iteration and extra convenience methods. TheorderedMapIterator()
method provides direct access to a bidirectional iterator. The iterators from the other views can also be cast toOrderedIterator
if required. All the available iterators can be reset back to the start by casting toResettableIterator
and callingreset()
. The implementation is also designed to be subclassed, with lots of useful methods exposed.