public class CollectionUtils
extends org.apache.commons.collections.CollectionUtils
Constructor and Description |
---|
CollectionUtils() |
Modifier and Type | Method and Description |
---|---|
static List |
addCreate(List list,
Object value)
Some code uses null to indicate "unset", which makes appending items complex.
|
static boolean |
containsType(Collection<?> collection,
Class<?> type) |
static void |
removeType(Collection<?> collection,
Class<?> type) |
static List |
singletonList(Object value) |
static <T> T[] |
toArrayOfComponentType(Collection objects,
Class<T> clazz)
Creates an array of the given Collection's elements, but with the given
Class as element type. |
static String |
toString(Collection c,
boolean newline)
Creates a String representation of the given Collection, with optional
newlines between elements.
|
static String |
toString(Collection c,
int maxElements)
Calls
toString(Collection, int, boolean) with false
for newline. |
static String |
toString(Collection c,
int maxElements,
boolean newline)
Creates a String representation of the given Collection, with optional
newlines between elements.
|
addAll, addAll, addAll, addIgnoreNull, cardinality, collect, collect, collect, collect, containsAny, countMatches, disjunction, exists, filter, find, forAllDo, get, getCardinalityMap, index, index, intersection, isEmpty, isEqualCollection, isFull, isNotEmpty, isProperSubCollection, isSubCollection, maxSize, predicatedCollection, removeAll, retainAll, reverseArray, select, select, selectRejected, selectRejected, size, sizeIsEmpty, subtract, synchronizedCollection, transform, transformedCollection, typedCollection, union, unmodifiableCollection
public static <T> T[] toArrayOfComponentType(Collection objects, Class<T> clazz)
Class
as element type. Useful for arrays of objects that
implement multiple interfaces and a "typed view" onto these objects is
required.objects
- a Collection of objectsclazz
- the desired service type of the new arraynull
when objects is null
, or a new
array containing the elements of the source array which is typed to
the given clazz
parameter.IllegalArgumentException
- if the clazz
argument is
null
.ArrayStoreException
- if the elements in objects
cannot
be cast to clazz
.public static String toString(Collection c, boolean newline)
c
- the Collection to formatnewline
- indicates whether elements are to be split across linespublic static String toString(Collection c, int maxElements)
toString(Collection, int, boolean)
with false
for newline.public static String toString(Collection c, int maxElements, boolean newline)
maxElements
values; overflow is indicated by
an appended "[..]" ellipsis.c
- the Collection to formatmaxElements
- the maximum number of elements to take into accountnewline
- indicates whether elements are to be split across linespublic static List addCreate(List list, Object value)
public static boolean containsType(Collection<?> collection, Class<?> type)
public static void removeType(Collection<?> collection, Class<?> type)
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.