VOOZH about

URL: https://www.geeksforgeeks.org/java/navigablemap-higherentry-method-in-java/

⇱ NavigableMap higherEntry() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

NavigableMap higherEntry() method in Java

Last Updated : 11 Jul, 2025
The higherEntry() method of NavigableMap interface in Java is used to return a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key existed. Syntax:
Map.Entry< K, V > higherEntry(K key)
Where, K is the type of key maintained by this map and V is the type of values mapped to the keys. Parameters: This function accepts a single parameter Key which refers to the type of key maintained by this map container. Return Value: It returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key existed. Below programs illustrate the higherEntry() method in Java: Program 1: When the key is integer.
Output:
The mapping with least key is : 3=three
Program 2: When the key is string.
Output:
The mapping associated with the least key is : six=seven
Reference: https://docs.oracle.com/javase/10/docs/api/java/util/NavigableMap.html#higherEntry(K)
Comment