public class BLCCollectionUtils extends Object
Constructor and Description |
---|
BLCCollectionUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> Collection<T> |
collect(Collection inputCollection,
TypedTransformer<T> transformer)
Delegates to
CollectionUtils.collect(Collection, Transformer) , but performs the necessary type coercion
to allow the returned collection to be correctly casted based on the TypedTransformer. |
static <T> T[] |
collectArray(Collection inputCollection,
TypedTransformer<T> transformer,
Class<T> clazz)
The same as
collect(Collection, TypedTransformer) but returns an array |
static <T> List<T> |
collectList(Collection inputCollection,
TypedTransformer<T> transformer)
The same as
collect(Collection, TypedTransformer) but returns an ArrayList |
static <T extends Collection> |
createChangeAwareCollection(WorkOnChange work,
Collection original)
Create a collection proxy that will perform some piece of work whenever modification methods are called on the
proxy.
|
static <T> List<T> |
createIfNull(List<T> list)
It is common to want to make sure that a collection you receive is not null.
|
static <T> List<T> |
selectList(Collection<T> inputCollection,
TypedPredicate<T> predicate)
Delegates to
CollectionUtils.select(Collection, org.apache.commons.collections.Predicate) , but will
force the return type to be a List |
public static <T> Collection<T> collect(Collection inputCollection, TypedTransformer<T> transformer)
CollectionUtils.collect(Collection, Transformer)
, but performs the necessary type coercion
to allow the returned collection to be correctly casted based on the TypedTransformer.inputCollection
- transformer
- public static <T> List<T> collectList(Collection inputCollection, TypedTransformer<T> transformer)
collect(Collection, TypedTransformer)
but returns an ArrayListinputCollection
- transformer
- public static <T> T[] collectArray(Collection inputCollection, TypedTransformer<T> transformer, Class<T> clazz)
collect(Collection, TypedTransformer)
but returns an arrayinputCollection
- transformer
- public static <T> List<T> selectList(Collection<T> inputCollection, TypedPredicate<T> predicate)
CollectionUtils.select(Collection, org.apache.commons.collections.Predicate)
, but will
force the return type to be a ListinputCollection
- predicate
- public static <T> List<T> createIfNull(List<T> list)
list
- public static <T extends Collection> T createChangeAwareCollection(WorkOnChange work, Collection original)
T
- the collection type (e.g. List, Set, etc...)work
- the work to perform on collection modificationoriginal
- the original collection to make change awareCopyright © 2022. All rights reserved.