Saturday, November 24, 2012

LinkedHashMap

java.util.LinkedHashMap (link)

LinkedHashMap internally has the following

1. HashMap of Key-Value pairs
2. LinkedList of keys.

The HashMap guarantees the Constant look-up time, where as the LinkedList representation of keys internally will return the list of keys which are ordered according to the insertion order.

Note: The update of the key-value doesn't change the order of keys. Removal and insertions of keys will change the order of Keys.

No comments:

Post a Comment