Java Utililty Methods HashMap Create

List of utility methods to do HashMap Create

Description

The list of methods to do HashMap Create are organized into topic(s).

Method

HashMapcreateHashMap()
Creates a mutable, empty HashMap instance.
return new HashMap<K, V>();
HashMapcreateHashMap()
create Hash Map
return new HashMap<K, V>();
MapcreateHashMap(int expectedMapSize)
Utility method that creates an java.util.HashMap with its initialCapacity calculated to minimize rehash operations
int initialCapacity = (int) (expectedMapSize / HASHMAP_DEFAULT_LOAD_FACTOR) + 1;
return new HashMap<K, V>(initialCapacity);
HashMapcreateHashMap(int initialCapacity)
create Hash Map
return new HashMap<K, V>(initialCapacity);
MapcreateHashMap(int initialCapacity)
Returns a hash map typed to the generics specified in the method call with the given initial capacity
return new HashMap<K, V>(initialCapacity);
MapcreateHashMap(int size)
Creates the hash map instance that will hold the given amount of elements.
return new HashMap<K, V>((int) (size * 1.1), 0.95f);
MapcreateHashMap(Object key, Object value)
create Hash Map
Map<Object, Object> map = new HashMap<Object, Object>();
map.put(key, value);
return map;
MapcreateHashMapIfNull(Map map)
create Hash Map If Null
if (map == null) {
    map = new HashMap<K, V>();
return map;
HashMapcreateHashMapWithSize(final int size)
Creates a new HashMap with the given expected size.
final int initialCapacity = (int) Math.ceil(size / DEFAULT_LOAD_FACTOR);
return new HashMap<KeyType, ValueType>(initialCapacity, DEFAULT_LOAD_FACTOR);
MapgetHashMap()
get Hash Map
return new HashMap<K, V>();