Map

1 min read Updated Mon May 18 2026 05:47:11 GMT+0000 (Coordinated Universal Time)

A data structure that stores key-value pairs. Keys are unique, and map to a value.

Map in Java

Map Hierarchy

Map interface defines the basic operations for a map data structure. SortedMap interface extends Map interface and provides additional methods for sorted maps such as firstKey(), lastKey(), headMap(), tailMap(), and subMap().

Three primary classes implement these interfaces HashMap, TreeMap, and LinkedHashMap.