NavigableMap in Java

A NavigableMap in Java extends a SortedMap¬†with navigation methods returning the closest matches for given search targets. Methods lowerEntry(), floorEntry(), ceilingEntry(), and higherEntry() return Map.Entry objects associated with keys respectively less than, less than or equal, greater than or equal, and greater…

WeakHashMap in Java

What is WeakHashMap WeakHashMap is based on Hash table implementation of the Map interface but with weak keys. An entry in a WeakHashMap will automatically be removed when its key is no longer in ordinary use. When a key has been discarded…

TreeMap in Java

What is TreeMap? It is a Red-Black tree based NavigableMap implementation. Like HashMap it contains only unique elements. Unlike HashMap it cannot have null key but like HashMap it can have multiple null values. The map is sorted according to the natural…

LinkedHashMap in Java

What is LinkedHashMap A LinkedHashMap like HashMap is a simple yet powerful way to store and get data. Unlike HashMap, LinkedHashMap is based on HashTable and Linked list implementation of the Map interface and stores items as key/value pairs. Like HashMap, LinkedHashMap…