Hi! Aurna
First I would like to address point b. of your question.
The option b is not true. I looked up the tutorial on maps in java.sun.docs and I quote :
" values(): The Collection of values contained in the Map. This Collection is not a Set, as multiple keys can map to the same value. "
Second - point d.
All keys in a map are unique - true. Again from java.sun.docs.
"A map cannot contain duplicate keys: Each key can map to at most one value. "
Third - point e.
All map implementations keep the keys sorted - false
Only sorted maps keep the keys sorted. Example of such a map is a TreeMap.
An example of an unsorted map is the HashMap.
I am not sure about the point a.
Hope this helps.
Latha
Originally posted by Aru Ven:
Hi all,
Which of these statements concerning Map are true ?
a. It is permisible for a map to contain itself as a key.
b. values() method return an instance of Set.
c. The Map interface extends the collection interface.
d. All keys in a map are unique.
e. All map implementations keep the keys sorted.
I know that "c" is false.
a. false. It is permisible for a map to contain itself as a value & not as a map
But I am confused about the other options.
the values() method in Map returns a Collection, so does that make "b" true???
And does All map implementations keep the keys sorted.???
Thx in advance
Aruna