VOOZH about

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

⇱ NavigableMap floorEntry() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

NavigableMap floorEntry() method in Java

Last Updated : 11 Jul, 2025
The floorEntry() method of NavigableMap interface in Java is used to return a key-value mapping associated with the greatest key less than or equal to the given key, or null if there is no such key. Syntax:
Map.Entry<K, V> floorEntry(K key)
Where, key is the key maintained by this map. Parameters: key - the key Return Value: It returns an entry with the greatest key less than or equal to key, or null if there is no such key. Below programs illustrate the floorEntry() method in Java: Program 1: When the key is integer.
Output:
The mapping with greatest key is : 2=two
Program 2: When the key is string.
Output:
The mapping associated with greatest key is : one=two
Reference: https://docs.oracle.com/javase/10/docs/api/java/util/NavigableMap.html#floorEntry(K)
Comment