Java Collection Tutorial - Java NavigableMap .navigableKeySet ()








Syntax

NavigableMap.navigableKeySet() has the following syntax.

NavigableSet < K > navigableKeySet()

Example

In the following code shows how to use NavigableMap.navigableKeySet() method.

import java.util.NavigableMap;
import java.util.TreeMap;
/*from  w w w.j a va 2s.c  o  m*/
public class Main {
  public static void main(String[] args) {
    NavigableMap<Integer, String> map = new TreeMap<Integer, String>();
    map.put(2, "two");
    map.put(1, "one");
    map.put(3, "three");
    System.out.println( map.navigableKeySet() + "\n");


  }
}

The code above generates the following result.