Hi All,
THe foll. Q is in the collections section of Dan's Exam.
Answer given is
13 c TreeSet The elements are not key/value pairs; so a Map is not a good choice. A List generally accepts duplicate elements. A Set stores a collection of unique objects; so any attempt to store a duplicate object is rejected. TreeSet stores elements in an order that is determined either by a Comparator or by the Comparable interface.
But the question is that given the property
" The entries can be sorted using the Comparable interface. "
But TreeSet is already sorted . So how can it be the answer ?
Can't HashSet be given as the answer as it is not already sorted ?
Sorry if I sound confused but I am really confused,
Thanks in advance,
Bye.