public class CollectionUtil
extends org.pfsw.util.CollectionUtil
Modifier and Type | Method and Description |
---|---|
<T> T[] |
asArray(java.util.Collection<T> coll,
java.lang.Class<T> elementType)
Returns an array which has elements of the specified element type.
|
<T> java.util.Set<T> |
asSet(T... objects)
Returns a new
HashSet initialized with the given objects. |
<T> java.util.stream.Stream<T> |
asStream(T[] array)
Returns the given array of objects as stream.
|
static CollectionUtil |
instance()
Returns the only instance this class supports (design pattern "Singleton")
|
boolean |
notAllAreNull(java.lang.Object... objects)
Returns true if at least one object in the given array is not null.
|
<T> boolean |
processAll(java.util.Collection<T> collection,
InterruptableProcessor<T> processor)
Calls the given processor for each element contained in the given collection,
until either the processor returns false or the collection elements are all
processed.
|
<T> boolean |
processAll(T[] array,
InterruptableProcessor<T> processor)
Calls the given processor for each element contained in the given array,
until either the processor returns false or the array elements are all
processed.
|
addAll, addAll, addAll, addAll, addAllNew, append, append, append, asEnumeration, asEnumeration, asIterator, asList, asList, asListType, asMap, asMap, contains, contains, contains, containsIdentical, convertCollectionElements, convertToList, convertToSet, copy, copy, copy, copy, copy, copyCollection, copyMap, copyPropertiesStartingWith, copyWithout, copyWithout, copyWithout, copyWithout, copyWithoutIdentical, createCollection, current, getFirstNonNull, indexOf, indexOf, indexOf, indexOfIdentical, indexOfObject, isAnyNull, isNoneNull, isNullOrEmpty, isNullOrEmpty, isNullOrEmpty, isNullOrEmpty, iterator, lastIndexOf, lastIndexOf, propertiesStartingWith, propertiesStartingWith, removeFromArray, removeNull, reverse, reverseCopy, splitToStringPair, toArray, toArray, toList
public static CollectionUtil instance()
public <T> T[] asArray(java.util.Collection<T> coll, java.lang.Class<T> elementType)
coll
- The collection of objects to be put into the result arrayelementType
- The type of the array elementsjava.lang.ArrayStoreException
- if any element in the collection is not of the same type as the element typepublic <T> java.util.stream.Stream<T> asStream(T[] array)
public <T> java.util.Set<T> asSet(T... objects)
HashSet
initialized with the given objects.public boolean notAllAreNull(java.lang.Object... objects)
public <T> boolean processAll(java.util.Collection<T> collection, InterruptableProcessor<T> processor)
collection
- A (maybe empty) collection of elements to process (must not be null).processor
- The processor to be called for each element of the collection (must not be null).public <T> boolean processAll(T[] array, InterruptableProcessor<T> processor)
array
- A (maybe empty) array of elements to process (must not be null).processor
- The processor to be called for each element of the array (must not be null).