Class CollectionUtils
java.lang.Object
nl.basjes.parse.useragent.utils.springframework.util.CollectionUtils
Miscellaneous collection utility methods.
Mainly for internal use within the framework.
- Since:
- 1.1.3
- Author:
- Juergen Hoeller, Rob Harrop, Arjen Poutsma
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isEmpty
(Collection<?> collection) Returntrue
if the supplied Collection isnull
or empty.static <K,
V> HashMap<K, V> newHashMap
(int expectedSize) Instantiate a new {link HashMap} with an initial capacity that can accommodate the specified number of elements without any immediate resize/rehash operations to be expected.
-
Constructor Details
-
CollectionUtils
public CollectionUtils()
-
-
Method Details
-
isEmpty
Returntrue
if the supplied Collection isnull
or empty. Otherwise, returnfalse
.- Parameters:
collection
- the Collection to check- Returns:
- whether the given Collection is empty
-
newHashMap
Instantiate a new {link HashMap} with an initial capacity that can accommodate the specified number of elements without any immediate resize/rehash operations to be expected.This differs from the regular {link HashMap} constructor which takes an initial capacity relative to a load factor but is effectively aligned with the JDK's {link java.util.concurrent.ConcurrentHashMap#ConcurrentHashMap(int)}.
- Parameters:
expectedSize
- the expected number of elements (with a corresponding capacity to be derived so that no resize/rehash operations are needed) see #newLinkedHashMap(int)- Since:
- 5.3
-