Java TreeMap navigableKeySet() Method Example

The descendingKeySet() method of java.util.TreeMap class returns a reverse order NavigableSet view of the keys contained in this map. The set’s iterator returns the keys in descending order whereas navigableKeySet() returns a NavigableSet view of the keys contained in this map. The set’s iterator returns the keys in ascending order. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa.
[Read more…]