A
Map
implementation that maintains the order of the entries. In this implementation order is maintained by original insertion.
This implementation improves on the JDK1.4 LinkedHashMap by adding the {@link org.apache.commons.collections4.MapIterator MapIterator}functionality, additional convenience methods and allowing bidirectional iteration. It also implements OrderedMap
. In addition, non-interface methods are provided to access the map by index.
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.
Note that LinkedMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization. The simplest approach is to wrap this map using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw exceptions when accessed by concurrent threads without synchronization.
@since 3.0
@version $Id: LinkedMap.java 1477799 2013-04-30 19:56:11Z tn $