2-the method should return higher key
2-it is method which return the key .and returning key should be satisfy one within following three condition
1- if the higher key exist then it return higher key .
2-if the higher key does not exist then returns the entry for the least key greater than the specified key
example :key 3 if 4 is not exist but 5 is there it's return 5
3-if it not satisfy upper two condition then it should be return null
Example:
package com.example;
import java.util.TreeMap;
public class Test1 {
public static void main(String[] args) {
TreeMap
treeExample.put(1, "AAA");
treeExample.put(2, "BBB");
treeExample.put(3, "CCC");
treeExample.put(4, "DDD");
treeExample.put(6, "FFF");
System.out.println(treeExample.higherKey(3));
System.out.println(treeExample.higherKey(4));
System.out.println(treeExample.higherKey(6));
}
}
Out Put:
4
6
null