List of utility methods to do HashMap Create
HashMap | newHashMap() new Hash Map return new HashMap<K, V>(); |
HashMap | newHashMap() new Hash Map return new HashMap<K, V>(); |
HashMap | newHashMap(final int initCapacity) Creates a new parameterized HashMap with a specified initial capacity.
return new HashMap<K, V>(initCapacity); |
HashMap | newHashMap(final int size) Returns a new HashMap initialized with a large enough capacity to allow adding size elements without causing a rehash.
return new HashMap<>(hashCapacityForSize(size)); |
HashMap | newHashMap(final K key, final V value) Returns newly created HashMap with the specified key and value pair added. final HashMap<K, V> map = new HashMap<K, V>(1); map.put(key, value); return map; |
Map | newHashMap(int capacity) Create a new hash map. return new HashMap<K, V>(capacity); |
HashMap | newHashMap(int size) new Hash Map return new HashMap<K, V>(getInitialCapacityFromExpectedSize(size)); |
HashMap | newHashMap(int size) new HashMap and initialCapacity return new HashMap<K, V>(); |
HashMap | newHashMap(int size) Create new HashMap . return new HashMap<K, V>(size); |
Map | newHashMap(K[] keys, V[] values) Create a new hash map and fills it from the given keys and values (keys[index] -> values[index]. Map<K, V> map = new HashMap<K, V>(); if (keys == null || values == null || keys.length != values.length) { throw new IllegalArgumentException("keys and values must be non-null and have the same size."); for (int i = 0; i < keys.length; i++) { map.put(keys[i], values[i]); return map; ... |