linkedhashmap.hLinkedHashMap class, which stores a set of key-value pairs.
A LinkedHashMap is the same as a HashMap, except that it exposes its key/value pairs in the order they were inserted, rather than in the unpredictable order of a standard HashMap.
This is accomplished by storing the data in two ways internally: (1) in a hash table array, as in a HashMap; and (2) in a linear list of keys, to remember the insertion order.
A LinkedHashMap provides identical lookup (containsKey / get / operator []) speed, nearly the same insertion (add / put) speed, and slower removal (remove) speed.
Its for-each loop and iterators emit the keys in the order they were added to the map, at the cost of the additional memory usage of the internal list.
| Class | |
| This class implements an efficient association between keys and values. | |