Question 4 � Each element must be unique. � Duplicate elements must not replace old elements. � Elements are not key/value pairs. � Accessing an element can be almost as fast as performing a similar operation on an array. Which of these classes provides the specified features? a. LinkedList b. TreeMap c. TreeSet d. HashMap e. HashSet f. LinkedHashMap g. Hashtable h. None of the above
What does this statement mean? Duplicate elements must not replace old elements Thanks.
add public boolean add(Object o)Adds the specified element to this set if it is not already present. Specified by: add in interface Set Overrides: add in class AbstractCollection Parameters: o - element to be added to this set. Returns: true if the set did not already contain the specified element.
This mechanism doesn't replace the elements if duplicates are detected.
pie. tiny ad:
a bit of art, as a gift, the permaculture playing cards