List of usage examples for java.util TreeMap TreeMap
public TreeMap()
From source file:Main.java
public static final <K, V> SortedMap<K, V> newTreeMap() { return new TreeMap<K, V>(); }
From source file:Main.java
/**** * TreeMap * @return */ public static <K, V> Map<K, V> newTreeMap() { return new TreeMap<K, V>(); }
From source file:Main.java
public static <T> TreeMap<String, T> arraryToTreeMap(T[] itemsArray) { TreeMap<String, T> map = new TreeMap<String, T>(); T[] arrayOfObject = itemsArray;//from w w w . j a va 2s .c om int j = itemsArray.length; for (int i = 0; i < j; i++) { T s = arrayOfObject[i]; map.put(s.toString(), s); } return map; }
From source file:Main.java
private static Map<Integer, Integer> mergeByTreeMap(int[] a, int[] b) { Map<Integer, Integer> map = new TreeMap<Integer, Integer>(); for (int i = 0; i < a.length; i++) { map.put(a[i], a[i]);//w w w . j a v a 2 s . c om } for (int i = 0; i < b.length; i++) { map.put(b[i], b[i]); } return map; }
From source file:Main.java
public static <K, V> TreeMap<K, V> getTreeMap() { return new TreeMap<K, V>(); }
From source file:Main.java
public static void addSystemPath(String key, String value) { if (pathMap == null) pathMap = new TreeMap<String, String>(); pathMap.put(key, value);//ww w. j av a2s . c o m }
From source file:Main.java
public static <K, V> TreeMap<K, V> createTreeMap() { return new TreeMap<K, V>(); }
From source file:Main.java
/** * Type-safe initializer.//from ww w .jav a 2 s . c om */ public static final <K, V> TreeMap<K, V> newTreeMap() { return new TreeMap<K, V>(); }
From source file:Main.java
public static <T> Map<T, Integer> frequency(Collection<? extends T> collection) { Map<T, Integer> res = new TreeMap<>(); for (T element : collection) { if (!res.containsKey(element)) { res.put(element, Collections.frequency(collection, element)); }//w w w . j a v a2 s . c o m } return res; }
From source file:Main.java
private static <T> Map<Integer, T> asMap(AtomicReferenceArray<T> a) { Map<Integer, T> map = new TreeMap<Integer, T>(); for (int i = 0; i < a.length(); i++) { T t = a.get(i);//w ww . ja va 2s .c om if (t != null) { map.put(i, t); } } return map; }