TreeMap descendingKeySet() method in java code example
Example: TreeMap descendingKeySet() method in java
import java.util.NavigableSet;
import java.util.TreeMap;
public class TreeMapDescendingKeySetMethodExample
{
public static void main(String[] args)
{
TreeMap<Integer, String> tm = new TreeMap<Integer, String>();
tm.put(63, "banana");
tm.put(56, "watermelon");
tm.put(35, "orange");
tm.put(83, "apple");
tm.put(65, "pineapple");
NavigableSet ns = tm.descendingKeySet();
System.out.println("TreeMap values using descendingKeySet() method: ");
System.out.println("NavigableSet values: " + ns);
}
}