Java Collections Tutorial Part - 3

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.
alt text

THE MAP ABSTRACT CLASS:
alt text

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.

alt text

The Time Complexities of basic operations are given below:
alt text

Click here to go to next tutorial


Java Collections Tutorial Series:

Java Collections Tutorial Part - 1

Java Collections Tutorial Part - 2

Java Collections Tutorial Part - 3

Java Collections Tutorial Part - 4

3 Likes

Nice . Carry on and try to simplify your tutorial.