Suppose that you are writing a class called Zoo and have an existing class CommonName that implements Comparable. You want to be able to look up any common names for species using their species names, and to keep the species names in alphabetical order.
A species may have more than one common name. For example, "mountain lion", "cougar" and "puma" are all common names for the species Felis concolor.
The class Zoo requires an instance variable namesCollection to reference a suitable collection. Which two of the following declarations are the most suitable for namesCollection, given the above description?
1.Map<HashSet<CommonName>, String> namesCollection;2.HashMap<String, Set<CommonName>> namesCollection;3.SortedMap<String, Set<CommonName>> namesCollection;4.HashMap<SortedSet<CommonName>, String> namesCollection;5.TreeMap<String, TreeSet<CommonName>> namesCollection;6.HashMap<TreeSet<CommonName>, String> namesCollection;
Be the first to answer this question.