List of usage examples for java.util TreeMap TreeMap
public TreeMap(SortedMap<K, ? extends V> m)
From source file:Main.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("Key higher after Sunday: %s%n", nav.higherKey("Sunday")); }
From source file:Main.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("Map before Sunday: %s%n", nav.navigableKeySet()); }
From source file:Main.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("Last key: %s\tLast entry: %s%n", nav.lastKey(), nav.lastEntry()); }
From source file:Main.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("Key floor before Sunday: %s%n", nav.floorKey("Sunday")); }
From source file:NavigableMapSample.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); }
From source file:NavigableMapSample.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("Key lower before Sunday: %s%n", nav.lowerKey("Sunday")); }
From source file:NavigableMapSample.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("Key ceiling after Sunday: %s%n", nav.ceilingKey("Sunday")); }
From source file:NavigableMapSample.java
public static void main(String args[]) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names); System.out.printf("Whole list:%n%s%n", nav); System.out.printf("First key: %s\tFirst entry: %s%n", nav.firstKey(), nav.firstEntry()); }
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); // call the getdisplaynames method Map<String, Integer> representations = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale); NavigableMap<String, Integer> navMap = new TreeMap<String, Integer>(representations); // print the results System.out.printf("Whole list:%n%s%n", navMap); }
From source file:Main.java
public static void main(String[] argv) throws Exception { List stuff = Arrays.asList(new String[] { "a", "b" }); List list = new ArrayList(stuff); List list2 = new LinkedList(list); Set set = new HashSet(stuff); Set set2 = new TreeSet(set); Map map = new HashMap(); Map map2 = new TreeMap(map); }