List of utility methods to do Map Create
Map | createMap() create Map return new HashMap<K, V>(); |
Map | createMap(boolean full) create Map final Map<String, Object> map = new HashMap<>(); map.put("mongoUri", URI); map.put("database", DB); if (full) { map.put("collection", COLL); map.put("batchSize", BATCH_SIZE); map.put("batchTimeMs", BATCH_TIME); return map; |
Map | createMap(int len) create Map if (len < 1) { return new HashMap(); return new HashMap(len); |
Map | createMap(Iterable extends Entry Initialize a map using a variable number of Entry objects as input Map<K, V> map = new HashMap<K, V>(); for (Entry<K, V> entry : entries) map.put(entry.getKey(), entry.getValue()); return map; |
Map | createMap(K k1, V v1) create Map Map<K, V> m = new HashMap<>(); m.put(k1, v1); return Collections.unmodifiableMap(m); |
Map | createMap(K[] keys, V[] values) create Map assert keys.length == values.length : "Lengths of keys and values should be the same"; Map<K, V> res = new HashMap<>(keys.length); for (int i = 0; i < keys.length; i++) res.put(keys[i], values[i]); return res; |
Map | createMap(List keys, List values) create Map Map<A, B> map = new HashMap<A, B>(); for (int i = 0; i < keys.size(); i++) { if (i == values.size()) { break; map.put(keys.get(i), values.get(i)); return map; ... |
Map | createMap(List Create a Map from a List of keys and a List of values if (keys == null || values == null || keys.size() != values.size()) { throw new IllegalArgumentException("Keys and Values cannot be null and must be the same size"); Map<Object, Object> newMap = new HashMap<Object, Object>(); for (int i = 0; i < keys.size(); i++) { newMap.put(keys.get(i), values.get(i)); return newMap; ... |
Map | createMap(Map create Map if (map == null) { return null; Map<K, V> result = new HashMap<K, V>(); result.putAll(map); return result; |
Map | createMap(Object keys[], Object values[]) create Map Map map = new HashMap(); if (keys.length != values.length) return map; for (int i = 0; i < keys.length; i++) map.put(keys[i], values[i]); return map; |