Java Programming - Objects and Collections - Discussion

Discussion Forum : Objects and Collections - General Questions (Q.No. 6)
6.
Which interface provides the capability to store objects using a key-value pair?
Java.util.Map
Java.util.Set
Java.util.List
Java.util.Collection
Answer: Option
Explanation:

An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.

Discussion:
4 comments Page 1 of 1.

Shubham said:   1 decade ago
Why the Java.util.Map class can not create duplicate key?

Pawan said:   1 decade ago
What is key value pair?

Kumar said:   9 years ago
A key value pair is used to the collection in Map interface where the key represents index and value represent the object at specific index value.

Thanks.

Nikhil said:   4 years ago
We can do this with any type of Collection, so why only Map? Please explain in detail.

Post your comments here:

Your comments will be displayed after verification.