public final class MapUtil extends Object
Modifier and Type | Method and Description |
---|---|
static int |
calculateInitialCapacity(int expectedMapSize)
Returns the initial hash map capacity needed for the expected map size.
|
static <K,V> ConcurrentMap<K,V> |
createConcurrentHashMap(int expectedMapSize)
Utility method that creates an
LinkedHashMap with its initialCapacity calculated
to minimize rehash operations |
static <K,V> Map<K,V> |
createHashMap(int expectedMapSize)
Utility method that creates an
HashMap with its initialCapacity calculated
to minimize rehash operations |
static <K,V> Map<K,V> |
createHashMapAdapter(int expectedMapSize)
Utility method that creates an
HashMapAdapter with its initialCapacity calculated
to minimize rehash operations |
static <V> Int2ObjectHashMap<V> |
createInt2ObjectHashMap(int expectedMapSize)
Utility method that creates an
Int2ObjectHashMap with its initialCapacity calculated
to minimize rehash operations |
static <K,V> Map<K,V> |
createLinkedHashMap(int expectedMapSize)
Utility method that creates an
LinkedHashMap with its initialCapacity calculated
to minimize rehash operations |
static boolean |
isNullOrEmpty(Map map)
Test the given map and return
true if the map is null or empty. |
public static <K,V> Map<K,V> createHashMap(int expectedMapSize)
HashMap
with its initialCapacity calculated
to minimize rehash operationspublic static <K,V> Map<K,V> createHashMapAdapter(int expectedMapSize)
HashMapAdapter
with its initialCapacity calculated
to minimize rehash operationspublic static <K,V> Map<K,V> createLinkedHashMap(int expectedMapSize)
LinkedHashMap
with its initialCapacity calculated
to minimize rehash operationspublic static <K,V> ConcurrentMap<K,V> createConcurrentHashMap(int expectedMapSize)
LinkedHashMap
with its initialCapacity calculated
to minimize rehash operationspublic static <V> Int2ObjectHashMap<V> createInt2ObjectHashMap(int expectedMapSize)
Int2ObjectHashMap
with its initialCapacity calculated
to minimize rehash operationspublic static int calculateInitialCapacity(int expectedMapSize)
expectedMapSize
- the expected map sizeHashMap
public static boolean isNullOrEmpty(Map map)
true
if the map is null or empty.map
- the map to testtrue
if map
is null or empty, otherwise false
.Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.