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 moreEnumMap in Java

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 moreMap in Java

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 moreLinkedHashMap in Java

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 moreTreeMap in Java