Java Treemap Beispiel Navigablemap
import java.util.*;
class Navigable_Tree_Map{
public static void main(String args[]){
NavigableMap<Integer,String> map=new TreeMap<Integer,String>();
map.put(93,"Afghanistan");
map.put(213,"Algeria");
map.put(55,"Brazil");
map.put(33,"France");
map.put(49,"Germany");
map.put(354,"Iceland");
System.out.println("Navigable Map in Decending Order: "+map.descendingMap());
System.out.println("Navigable Map using headMap() method: "+map.headMap(49,true));
System.out.println("Navigable Map using tailMap() method: "+map.tailMap(49,true));
System.out.println("Navigable Map using subMap() method: "+map.subMap(33, false, 55, true));
}
}
Outrageous Ostrich