![]() |
VOOZH | about |
The ceilingKey() method of java.util.concurrent.ConcurrentSkipListMap is an in-built function in Java which returns the least key greater than or equal to the given key. If there is no such value then null is returned. The method throws NullPointerException when there is no key. Syntax:
public K ceilingKey(K key)
Parameter: The function accepts a single mandatory parameter key which specifies the key. Return Value: The function returns the least key greater than or equal to key, or null if there is no such key. Exceptions: The method throws two types of exceptions:
Below programs illustrate the above method: Program 1:
Map: {1=1, 2=7, 5=2}
key greater than or equal 3: 5
key greater than or equal 2: 2Program 2:
Map: {11=1, 51=42, 92=7}
key greater than or equal 11: 11
key greater than or equal 51: 51