2-return key .
3- Gets the entry corresponding to the specified key;
4-if no such entry exists, returns the entry for the least key greater than the specified key;
5-if no such entry exists (i.e., the greatest key in the Tree is less than the specified key), returns null
Example:
package com.example;
import java.util.TreeMap;
public class Test2 {
public static void main(String[] args) {
TreeMap
treeExample.put(1, "AAA");
treeExample.put(2, "BBB");
treeExample.put(4, "DDD");
System.out.println(treeExample.ceilingKey(1));
System.out.println(treeExample.ceilingKey(3));
System.out.println(treeExample.ceilingKey(6));
}
}
Out Put:
1
4
null.