Java Collection Tutorial - Java NavigableMap.lowerEntry(K key)








Syntax

NavigableMap.lowerEntry(K key) has the following syntax.

Map.Entry < K , V > lowerEntry(K key)

Example

In the following code shows how to use NavigableMap.lowerEntry(K key) method.

/*from   w  w  w . j  a v  a  2  s . c om*/
import java.util.Iterator;
import java.util.NavigableMap;
import java.util.NavigableSet;
import java.util.TreeMap;

public class Main {
  public static void main(String[] args) {
    NavigableMap<String, Integer> navigableMap = new TreeMap<String, Integer>();
    String[] letters = { "a", "b", "c" };
    int[] ints = { 3, 2, 1 };
    for (int i = 0; i < letters.length; i++){
      navigableMap.put(letters[i], ints[i]);
    }
    System.out.println("Map = " + navigableMap);
    System.out.println("Entry < a is " + navigableMap.lowerEntry("a"));
  }
}

The code above generates the following result.