WeakHashMap in Java

Java WeakHashMap hierarchy diagram

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…

Read MoreWeakHashMap in Java

LinkedHashMap in Java

Hierarchy diagram of LinkedHashMap in Java

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

Read MoreLinkedHashMap in Java

HashMap in Java

Java HashMap hierarchy diagram

HashMap in Java is an unordered collection that stores elements (objects) in the form of key-value pairs (called entries). It is expressed as HashMap<Key, Value>, or HashMap<K, V>, where K stands for key and V for value. Both Key and…

Read MoreHashMap in Java

TreeSet in Java

TreeSet hierarchy in Java

A TreeSet in Java is another important implementation of the Set interface that is similar to the HashSet class, with one added improvement. It sorts elements in ascending order while HashSet does not maintain any order. Java TreeSet implements SortedSet…

Read MoreTreeSet in Java