Suppose we want to store MyClass objects.
Which of the following pairs require MyClass to implement the Comparable interface or create a Comparator in order to add them to the Collection?
D.
TreeMap and TreeSet keep track of sort order when you insert elements.
TreeMap sorts the keys and TreeSet sorts the objects in the set.
This makes Option D correct.
Note that you have the option of having MyClass implement Comparable, or you can pass a Comparator to the constructor of TreeMap or TreeSet.