public abstract class CollectionUtils extends CollectionUtils
Collection
,
Collections
,
CollectionUtils
Constructor and Description |
---|
CollectionUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> Iterable<T> |
iterable(Enumeration<T> enumeration)
Adapts the given Enumeration as an Iterable object for use within a for each loop.
|
static <T> Iterable<T> |
iterable(Iterator<T> iterator)
Adapts the given Iterator as an Iterable object for use within a for each loop.
|
static <T> Collection<T> |
nullSafeCollection(Collection<T> collection)
A null-safe operation returning the original Collection if non-null or an empty Collection
(implemented with List) if null.
|
static <T> Iterable<T> |
nullSafeIterable(Iterable<T> iterable)
A null-safe operation returning the original Iterable object if non-null or a default, empty Iterable
implementation if null.
|
arrayToList, contains, contains, containsAny, containsInstance, findCommonElementType, findFirstMatch, findValueOfType, findValueOfType, hasUniqueObject, isEmpty, isEmpty, mergeArrayIntoCollection, mergePropertiesIntoMap, toArray, toIterator, toMultiValueMap, unmodifiableMultiValueMap
public static <T> Iterable<T> iterable(Enumeration<T> enumeration)
T
- the class type of the Enumeration elements.enumeration
- the Enumeration to adapt as an Iterable object.Iterable
,
Enumeration
public static <T> Iterable<T> iterable(Iterator<T> iterator)
public static <T> Collection<T> nullSafeCollection(Collection<T> collection)
T
- the element class type of the Collection.collection
- the Collection to evaluate for being null.Collections.emptyList()