Category Java

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…

TreeMap in Java (with Examples)

Java TreeMap hierarchy diagram

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…

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…

Internal Working of HashMap in Java

Internal working of HashMap in Java using Hashing

In this tutorial, we will learn the internal working of HashMap in Java 8 step by step with the help of an example. If you do not familiar with the basic features of Java HashMap, first go to this tutorial…

How to Iterate HashMap in Java

In this tutorial, we will learn how to iterate HashMap in Java. Java provides multiple convenient ways to iterate over a hash map. We can iterate over keys, values, or both. We can also remove an element from a map…