Register Now

Login

Lost Password

Enter your email to reset your password.

BY Author

Java – Map Interface

Before starting directly with a Map, let’s see first what is a key & value.

Key is an object used to pair with a value. It is always unique & used to recognize value.

Value is an object always paired with a key.

Each KeyValue pair is known as an Entry.

Java Programming Language Map Interface

Maps

Maps work with a group of Key-Value pairs (a group of Entry). That is map is an object that stores key-value pairs.

Collection Framework works with a group of single objects.

Difference between Collections & Maps is as shown below:

Java Programming Language Difference Between Collections Framework and Maps

Keys are always Unique.

Values may be duplicated.

Some maps may contain null key & null values, but others cannot.

Maps are not collections.

Java Map Hierarchy
Java Programming Language Map Hierarchy

Map Interface Declaration

interface Map<K,V>

Map interface associates a unique key with a value to form key-value pair.

K specifies Keys.

V specifies Values.

List of Map Interface Methods (CLICK HERE)

 

Leave a reply