aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes duplicates in collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "duplicates in collection" Watch "duplicates in collection" New topic
Author

duplicates in collection

Barkat Mardhani
Ranch Hand

Joined: Aug 05, 2002
Posts: 787
Q. From following interfaces/class, identify ones that do not allow duplicates?
The answer given is Map and Set. Why Map?
Alton Hernandez
Ranch Hand

Joined: May 30, 2003
Posts: 443
Perhaps because Map does not allow duplicate keys.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
map cares about unique identifiers.
set does not allow duplicates.


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Alton Hernandez
Ranch Hand

Joined: May 30, 2003
Posts: 443
From the Java API Doc:

A map cannot contain duplicate keys; each key can map to at most one value.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: duplicates in collection
 
Similar Threads
Map
Collection question
HashMap/Tree map question
Map: no duplicates allowed?
how to put duplicate keys in a hashmap