So far we have discussed Iterators, Collection Interfaces and Classes. In this tutorial we shall
discuss about Maps.
MAPS
● A map is an object that stores key/value pairs.
● The keys must be unique but the values may be duplicated.
● Maps don’t implement the Iterable interface. Therefore, you can’t obtain an iterator to a
map.
THE MAP INTERFACE
These interfaces define the character and nature of maps.
THE MAP ABSTRACT CLASS:
THE MAP CLASSES:
These classes provide concrete implementation of the Map which can used by programmers.
The below table shows various differences among the Map classes. All the terms used in the
table are same as the one used in Collection Classes table except one, which is -
1) Random Access - In Maps, Random access is “Yes” if get(key) returns the value associated
with that key.
The Time Complexities of basic operations are given below:
Click here to go to next tutorial
Java Collections Tutorial Series:
Java Collections Tutorial Part - 1
Java Collections Tutorial Part - 2