List of utility methods to do Array to Map
HashMap | toMap(T[][] pairs) to Map HashMap<T, T> map = new HashMap<>(); for (T[] pair : pairs) { map.put(pair[0], pair[1]); return map; |
HashMap | toMap(T[][] ts) to Map HashMap<T, T> out = new HashMap<T, T>(ts.length); for (int i = 0; i < ts.length; i++) out.put(ts[i][0], ts[i][1]); return out; |