@Deprecated
public abstract class CollectionUtils
extends java.lang.Object
| Constructor and Description |
|---|
CollectionUtils()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.List |
arrayToList(java.lang.Object source)
Deprecated.
Convert the supplied array into a List.
|
static boolean |
contains(java.util.Enumeration<?> enumeration,
java.lang.Object element)
Deprecated.
Check whether the given Enumeration contains the given element.
|
static boolean |
contains(java.util.Iterator<?> iterator,
java.lang.Object element)
Deprecated.
Check whether the given Iterator contains the given element.
|
static boolean |
containsAny(java.util.Collection<?> source,
java.util.Collection<?> candidates)
Deprecated.
Return
true if any element in 'candidates' is contained in 'source'; otherwise returns
false. |
static boolean |
containsInstance(java.util.Collection<?> collection,
java.lang.Object element)
Deprecated.
Check whether the given Collection contains the given element instance.
|
static java.lang.Class<?> |
findCommonElementType(java.util.Collection<?> collection)
Deprecated.
Find the common element type of the given Collection, if any.
|
static <E> E |
findFirstMatch(java.util.Collection<?> source,
java.util.Collection<E> candidates)
Deprecated.
Return the first element in '
candidates' that is contained in 'source'. |
static java.lang.Object |
findValueOfType(java.util.Collection<?> collection,
java.lang.Class<?>[] types)
Deprecated.
Find a single value of one of the given types in the given Collection: searching the Collection for a value of
the first type, then searching for a value of the second type, etc.
|
static <T> T |
findValueOfType(java.util.Collection<?> collection,
java.lang.Class<T> type)
Deprecated.
Find a single value of the given type in the given Collection.
|
static boolean |
hasUniqueObject(java.util.Collection<?> collection)
Deprecated.
Determine whether the given Collection only contains a single unique object.
|
static boolean |
isEmpty(java.util.Collection<?> collection)
Deprecated.
Return
true if the supplied Collection is null or empty. |
static boolean |
isEmpty(java.util.Map<?,?> map)
Deprecated.
Return
true if the supplied Map is null or empty. |
static <E> void |
mergeArrayIntoCollection(java.lang.Object array,
java.util.Collection<E> collection)
Deprecated.
Merge the given array into the given Collection.
|
static <K,V> void |
mergePropertiesIntoMap(java.util.Properties props,
java.util.Map<K,V> map)
Deprecated.
Merge the given Properties instance into the given Map, copying all properties (key-value pairs) over.
|
static <A,E extends A> |
toArray(java.util.Enumeration<E> enumeration,
A[] array)
Deprecated.
Marshal the elements from the given enumeration into an array of the given type.
|
static <E> java.util.Iterator<E> |
toIterator(java.util.Enumeration<E> enumeration)
Deprecated.
Adapt an enumeration to an iterator.
|
static <K,V> MultiValueMap<K,V> |
toMultiValueMap(java.util.Map<K,java.util.List<V>> map)
Deprecated.
Adapt a
Map<K, List<V>> to an MultiValueMap<K, V>. |
static <K,V> MultiValueMap<K,V> |
unmodifiableMultiValueMap(MultiValueMap<? extends K,? extends V> map)
Deprecated.
Return an unmodifiable view of the specified multi-value map.
|
public static boolean isEmpty(java.util.Collection<?> collection)
true if the supplied Collection is null or empty. Otherwise, return false.collection - the Collection to check.public static boolean isEmpty(java.util.Map<?,?> map)
true if the supplied Map is null or empty. Otherwise, return false.map - the Map to check.public static java.util.List arrayToList(java.lang.Object source)
NOTE: Generally prefer the standard Arrays.asList(T...) method. This arrayToList method is
just meant to deal with an incoming Object value that might be an Object[] or a primitive array at
runtime.
StandardCookieProcessor null source value will be converted to an empty List.
source - the (potentially primitive) array.public static <E> void mergeArrayIntoCollection(java.lang.Object array,
java.util.Collection<E> collection)
array - the array to merge (may be null).collection - the target Collection to merge the array into.public static <K,V> void mergePropertiesIntoMap(java.util.Properties props,
java.util.Map<K,V> map)
Uses
Properties.propertyNames() to even catch default properties linked into the original Properties
instance.
props - the Properties instance to merge (may be null).map - the target Map to merge the properties into.public static boolean contains(java.util.Iterator<?> iterator,
java.lang.Object element)
iterator - the Iterator to check.element - the element to look for.true if found, false else.public static boolean contains(java.util.Enumeration<?> enumeration,
java.lang.Object element)
enumeration - the Enumeration to check.element - the element to look for.true if found, false else.public static boolean containsInstance(java.util.Collection<?> collection,
java.lang.Object element)
Enforces the given instance to be
present, rather than returning true for an equal element as well.
collection - the Collection to check.element - the element to look for.true if found, false else.public static boolean containsAny(java.util.Collection<?> source,
java.util.Collection<?> candidates)
true if any element in 'candidates' is contained in 'source'; otherwise returns
false.source - the source Collection.candidates - the candidates to search for.public static <E> E findFirstMatch(java.util.Collection<?> source,
java.util.Collection<E> candidates)
candidates' that is contained in 'source'. If no element in 'candidates' is present in 'source' returns null. Iteration order is Collection
implementation specific.source - the source Collection.candidates - the candidates to search for.null if not found.public static <T> T findValueOfType(java.util.Collection<?> collection,
java.lang.Class<T> type)
collection - the Collection to search.type - the type to look for.null if none or more than one such
value found.public static java.lang.Object findValueOfType(java.util.Collection<?> collection,
java.lang.Class<?>[] types)
collection - the collection to search.types - the types to look for, in prioritized order.null if none or more than
one such value found.public static boolean hasUniqueObject(java.util.Collection<?> collection)
collection - the Collection to check.true if the collection contains a single reference or multiple references to the same instance,
false else.public static java.lang.Class<?> findCommonElementType(java.util.Collection<?> collection)
collection - the Collection to check.null if no clear common type has been found (or the collection was
empty).public static <A,E extends A> A[] toArray(java.util.Enumeration<E> enumeration,
A[] array)
public static <E> java.util.Iterator<E> toIterator(java.util.Enumeration<E> enumeration)
enumeration - the enumeration.public static <K,V> MultiValueMap<K,V> toMultiValueMap(java.util.Map<K,java.util.List<V>> map)
Map<K, List<V>> to an MultiValueMap<K, V>.map - the original map.public static <K,V> MultiValueMap<K,V> unmodifiableMultiValueMap(MultiValueMap<? extends K,? extends V> map)
map - the map for which an unmodifiable view is to be returned.