Java NavigableMap get sub map by key value

Description

Java NavigableMap get sub map by key value

import java.util.NavigableMap;
import java.util.TreeMap;

public class Main {
  public static void main(String[] args) {
    NavigableMap<Integer, String> map = new TreeMap<Integer, String>();
    map.put(1, "CSS");
    map.put(2, "HTML");
    map.put(3, "Java");
    map.put(4, "Javascript");
    map.put(5, "SQL");

    System.out.println(map);//from ww w.j  a  v a2s.  c  om
    System.out.println(map.subMap(4, true, 5, true).values());
    
    
  }
}



PreviousNext

Related