EnumMap in Java

EnumMap in Java EnumMap in Java is a specialized class that implements the Map interface for enum data types. It belongs to the java.util package. It maintains natural sorting order on the basis of the keys in the map. Features of EnumMap It is an ordered collection of elements of …

Read more

Map in Java

Map interface in Java In Java, Map is an interface that is part of the Collection framework and stores data in the form of key-value pairs. It is not a subtype of Collection interface and hence has its own special feature. We can retrieve the value based on the corresponding …

Read more

LinkedHashMap in Java

LinkedHashMap class in Java is a LinkedList implementation that is similar to a HashMap but preserves the insertion order. It extends the HashMap class and implements the Map interface. It uses the doubly LinkedList implementation to iterate through all the nodes in the LinkedHashMap. Features of LinkedHashMap It maintains the …

Read more

TreeMap in Java

Java TreeMap is a class that implements the Map interface. It is a tree-based implementation that can store key-value data in sorted order efficiently. It is similar to HashMap but has a few differences which we will see towards the end of this tutorial. TreeMap in Java TreeMap stores values …

Read more

HashMap Java

HashMap Java stores the data in the form of key-value pairs where the key data should be unique. We can access the values based on the corresponding key data. HashMap is present in Java’s Collection framework and is part of java.util package. It works on the principle of the Hashing …

Read more