Java NavigableMap.ceilingEntry(K key)

Syntax

NavigableMap.ceilingEntry(K key) has the following syntax.

Map.Entry < K , V > ceilingEntry(K key)

Example

In the following code shows how to use NavigableMap.ceilingEntry(K key) method.


 /*from  w  w  w  .j  a v a 2  s.  c  o m*/
import java.util.NavigableMap;
import java.util.TreeMap;

public class Main {
  public static void main(String args[]) {
    
    NavigableMap<String, String> nav = new TreeMap<String, String>();
    nav.put("A", "a");
    nav.put("B", "b");
    nav.put("C", "c");
    nav.put("D", "d");
    nav.put("E", "e");
    nav.put("F", "f");
    System.out.println(nav);
    System.out.println(nav.ceilingEntry("B"));
  }
}
  

The code above generates the following result.