0
Explanation is Needed. Please help me
we need to store elements in a collection that guarantees that no duplicates are stored and all elements can be accessed in natural order. Which interface provides that capability?
2 Antworten
+ 1
YOU NEED TO USE LinkedHashSet
The HashSet class does not automatically retain the order of the elements as they're added. To order the elements, use a LinkedHashSet, which maintains a linked list of the set's elements in the order in which they were inserted.
0
Set store only unique elements, I am not sure about natural order.