IdentityHashMap in Java | Methods, Example

IdentityHashMap in Java is a concrete class that is similar to HashMap except that it uses reference equality (==) when comparing entries (keys and values). In simple words, Java IdentityHashMap uses reference equality (==) instead of object equality (equals() method) when comparing keys and values. While comparing keys, HashMap uses … Read more

WeakHashMap in Java | Methods, Example

WeakHashMap in Java is a class that provides another Map implementation based on weak keys. It was added in JDK 1.2 version and present in java.util.WeakHashMap. Java WeakHashMap extends AbstractMap class to use HashTable with weak keys. The key of WeakHashMap has a weak reference that allows an entry in … Read more

TreeMap in Java | Methods, Example

TreeMap in Java is a concrete class that is a red-black tree based implementation of the Map interface. It provides an efficient way of storing key/value pairs in sorted order automatically and allows rapid retrieval. It was added in JDK 1.2 and present in java.util.TreeMap. A TreeMap implementation provides guaranteed … Read more

LinkedHashMap in Java | Methods, Example

LinkedHashMap in Java is a concrete class that is HashTable and LinkedList implementation of Map interface. It stores entries using a doubly-linked list. Java LinkedHashMap class extends the HashMap class with a linked-list implementation that supports an ordering of the entries in the map. LinkedHashMap in Java was added in … Read more