About Question com.enthuware.ets.scjp.v6.2.83 :
Posted: Sun Jun 25, 2017 4:37 pm
From the explanation:
A Set contains no duplicate elements. Although the keys of a Map cannot contain duplicates, the values can. Hence, Map.values() can't return a Set, it returns a Collection.
Is this an error?Only Map has values() method. This method returns a Set of values stored in the Map.
A Set contains no duplicate elements. Although the keys of a Map cannot contain duplicates, the values can. Hence, Map.values() can't return a Set, it returns a Collection.