java.lang.Objectjava.util.AbstractMap
org.apache.commons.collections.map.AbstractHashedMap
org.apache.commons.collections.map.AbstractLinkedMap
All Implemented Interfaces:
OrderedMap, IterableMap, Map
Direct Known Subclasses:
LRUMap, MockLRUMapSubclass, MockLRUMapSubclassFirstBlocksRemove, MockLRUMapSubclassBlocksRemove, LinkedMap
This class implements all the features necessary for a subclass linked
hash-based map. Key-value entries are stored in instances of the
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. The OrderedMap interface is implemented
to provide access to bidirectional iteration and extra convenience methods.
The orderedMapIterator() method provides direct access to a
bidirectional iterator. The iterators from the other views can also be cast
to OrderedIterator if required.
All the available iterators can be reset back to the start by casting to
ResettableIterator and calling reset().
The implementation is also designed to be subclassed, with lots of useful methods exposed.
Commons - Collections 3.0$ - Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $java - util LinkedHashMapStephen - Colebourne| Nested Class Summary: | ||
|---|---|---|
| protected static class | AbstractLinkedMap.LinkMapIterator | MapIterator implementation. |
| protected static class | AbstractLinkedMap.EntrySetIterator | EntrySet iterator. |
| protected static class | AbstractLinkedMap.KeySetIterator | KeySet iterator. |
| protected static class | AbstractLinkedMap.ValuesIterator | Values iterator. |
| protected static class | AbstractLinkedMap.LinkEntry | LinkEntry that stores the data.
If you subclass |
| abstract protected static class | AbstractLinkedMap.LinkIterator | Base Iterator that iterates in link order. |
| Field Summary | ||
|---|---|---|
| protected transient AbstractLinkedMap.LinkEntry | header | Header in the linked list |
| Constructor: |
|---|
|
|
|
|
|
| Method from org.apache.commons.collections.map.AbstractLinkedMap Summary: |
|---|
| addEntry, clear, containsValue, createEntry, createEntrySetIterator, createKeySetIterator, createValuesIterator, entryAfter, entryBefore, firstKey, getEntry, init, lastKey, mapIterator, nextKey, orderedMapIterator, previousKey, removeEntry |
| Methods from org.apache.commons.collections.map.AbstractHashedMap: |
|---|
| addEntry, addMapping, calculateNewCapacity, calculateThreshold, checkCapacity, clear, clone, containsKey, containsValue, convertKey, createEntry, createEntrySetIterator, createKeySetIterator, createValuesIterator, destroyEntry, doReadObject, doWriteObject, ensureCapacity, entryHashCode, entryKey, entryNext, entrySet, entryValue, equals, get, getEntry, hash, hashCode, hashIndex, init, isEmpty, isEqualKey, isEqualValue, keySet, mapIterator, put, putAll, remove, removeEntry, removeMapping, reuseEntry, size, toString, updateEntry, values |
| Methods from java.util.AbstractMap: |
|---|
| clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.apache.commons.collections.map.AbstractLinkedMap Detail: |
|---|
This implementation adds the entry to the data storage table and to the end of the linked list. |
|
|
This implementation creates a new LinkEntry instance. |
|
|
|
after field from a LinkEntry.
Used in subclasses that have no visibility of the field. |
before field from a LinkEntry.
Used in subclasses that have no visibility of the field. |
|
|
NOTE: As from v3.2 this method calls #createEntry(HashEntry, int, Object, Object) to create the map entry object. |
|
A MapIterator returns the keys in the map. It also provides convenient methods to get the key and value, and set the value. It avoids the need to create an entrySet/keySet/values object. |
|
A MapIterator returns the keys in the map. It also provides convenient methods to get the key and value, and set the value. It avoids the need to create an entrySet/keySet/values object. |
|
This implementation removes the entry from the linked list chain, then calls the superclass implementation. |