org.mule.util
Class CollectionUtils

java.lang.Object
  extended by org.apache.commons.collections.CollectionUtils
      extended by org.mule.util.CollectionUtils

public class CollectionUtils
extends org.apache.commons.collections.CollectionUtils


Field Summary
 
Fields inherited from class org.apache.commons.collections.CollectionUtils
EMPTY_COLLECTION
 
Constructor Summary
CollectionUtils()
           
 
Method Summary
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.
 
Methods inherited from class org.apache.commons.collections.CollectionUtils
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionUtils

public CollectionUtils()
Method Detail

toArrayOfComponentType

public 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. Useful for arrays of objects that implement multiple interfaces and a "typed view" onto these objects is required.

Parameters:
objects - a Collection of objects
clazz - the desired service type of the new array
Returns:
null when objects is null, or a new array containing the elements of the source array which is typed to the given clazz parameter.
Throws:
IllegalArgumentException - if the clazz argument is null.
ArrayStoreException - if the elements in objects cannot be cast to clazz.

toString

public static String toString(Collection c,
                              boolean newline)
Creates a String representation of the given Collection, with optional newlines between elements. Class objects are represented by their full names.

Parameters:
c - the Collection to format
newline - indicates whether elements are to be split across lines
Returns:
the formatted String

toString

public static String toString(Collection c,
                              int maxElements)
Calls toString(Collection, int, boolean) with false for newline.


toString

public static String toString(Collection c,
                              int maxElements,
                              boolean newline)
Creates a String representation of the given Collection, with optional newlines between elements. Class objects are represented by their full names. Considers at most maxElements values; overflow is indicated by an appended "[..]" ellipsis.

Parameters:
c - the Collection to format
maxElements - the maximum number of elements to take into account
newline - indicates whether elements are to be split across lines
Returns:
the formatted String

addCreate

public static List addCreate(List list,
                             Object value)
Some code uses null to indicate "unset", which makes appending items complex.


singletonList

public static List singletonList(Object value)

containsType

public static boolean containsType(Collection<?> collection,
                                   Class<?> type)

removeType

public static void removeType(Collection<?> collection,
                              Class<?> type)


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.