|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.omnaest.utils.structure.collection.ListUtils
public class ListUtils
Helper class for modifying List instances.
| Nested Class Summary | |
|---|---|
static interface |
ListUtils.ElementTransformer<FROM,TO>
The provides the transformation method to transform one generic element instance into another. |
static class |
ListUtils.ElementTransformerIdentitiyCast<FROM,TO>
Simple ListUtils.ElementTransformer implementation which casts the given object and returns it. |
static interface |
ListUtils.MultiElementTransformer<FROM,TO>
The provides the transformation method to transform one generic Collection instance into one or multiple elements of
other type. |
| Constructor Summary | |
|---|---|
ListUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
intersection(Collection<? extends Collection<E>> listCollection)
Returns a new List with only this elements which are in all of the given Lists |
|
static
|
iteratorAsList(Iterator<E> iterator)
Creates a List from a given Iterator |
|
static
|
lastElementOf(List<E> list)
Returns the last element of the given List. |
|
static
|
lastElementOf(List<E> list,
int reverseIndexPosition)
Returns the element of the given List at the given reverse index position which is counted beginning from the last
element. |
|
static
|
mergeAll(Collection<? extends Collection<E>> collections)
Merges all elements of the given Collection instances into one single List instance which keeps the order of
the elements. |
|
static
|
mergeAll(Collection<E>... collections)
Merges all elements of the given Collection instances into one single List instance which keeps the order of
the elements. |
|
static
|
transform(Collection<FROM> collection,
ListUtils.ElementTransformer<FROM,TO> elementTransformer)
Transforms a given Collection instance from one generic type into the other using a given ListUtils.ElementTransformer. |
|
static
|
transform(Collection<FROM> collection,
ListUtils.ElementTransformer<FROM,TO> elementTransformer,
boolean eliminateNullValues)
Transforms a given Collection instance from one generic type into the other using a given ListUtils.ElementTransformer. |
|
static
|
transform(Collection<FROM> collection,
ListUtils.MultiElementTransformer<FROM,TO> multiElementTransformer)
Transforms a given Collection instance from one generic type into the other using a given
ListUtils.MultiElementTransformer. |
|
static
|
transform(Collection<FROM> collection,
ListUtils.MultiElementTransformer<FROM,TO> multiElementTransformer,
boolean eliminateNullValues)
Transforms a given Collection instance from one generic type into the other using a given ListUtils.ElementTransformer. |
|
static
|
transformListExcludingNullElements(Collection<FROM> collection,
ListUtils.ElementTransformer<FROM,TO> elementTransformer)
Transforms a given Collection instance from one generic type into the other using a given ListUtils.ElementTransformer. |
|
static
|
transformListExcludingNullElements(Collection<FROM> collection,
ListUtils.MultiElementTransformer<FROM,TO> multiElementTransformer)
Transforms a given Collection instance from one generic type into the other using a given
ListUtils.MultiElementTransformer. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ListUtils()
| Method Detail |
|---|
public static <E> List<E> iteratorAsList(Iterator<E> iterator)
List from a given Iterator
iterator -
public static <FROM,TO> List<TO> transform(Collection<FROM> collection,
ListUtils.ElementTransformer<FROM,TO> elementTransformer)
Collection instance from one generic type into the other using a given ListUtils.ElementTransformer.
collection - elementTransformer - transform(Collection, ElementTransformer, boolean)
public static <FROM,TO> List<TO> transform(Collection<FROM> collection,
ListUtils.MultiElementTransformer<FROM,TO> multiElementTransformer)
Collection instance from one generic type into the other using a given
ListUtils.MultiElementTransformer.
collection - multiElementTransformer - transform(Collection, ElementTransformer, boolean)
public static <FROM,TO> List<TO> transformListExcludingNullElements(Collection<FROM> collection,
ListUtils.ElementTransformer<FROM,TO> elementTransformer)
Collection instance from one generic type into the other using a given ListUtils.ElementTransformer.
Every null value returned by the ListUtils.ElementTransformer will be discarded and not put into the result list.
collection - elementTransformer - transform(Collection, ElementTransformer, boolean)
public static <FROM,TO> List<TO> transformListExcludingNullElements(Collection<FROM> collection,
ListUtils.MultiElementTransformer<FROM,TO> multiElementTransformer)
Collection instance from one generic type into the other using a given
ListUtils.MultiElementTransformer. Every null value returned by the ListUtils.ElementTransformer will be discarded and not put
into the result list.
collection - multiElementTransformer - transform(Collection, ElementTransformer, boolean)
public static <FROM,TO> List<TO> transform(Collection<FROM> collection,
ListUtils.ElementTransformer<FROM,TO> elementTransformer,
boolean eliminateNullValues)
Collection instance from one generic type into the other using a given ListUtils.ElementTransformer.
collection - elementTransformer - eliminateNullValues - : true->all null results from the element transformer will be discarded and not inserted into the result list.transform(Collection, ElementTransformer)
public static <FROM,TO> List<TO> transform(Collection<FROM> collection,
ListUtils.MultiElementTransformer<FROM,TO> multiElementTransformer,
boolean eliminateNullValues)
Collection instance from one generic type into the other using a given ListUtils.ElementTransformer.
collection - multiElementTransformer - eliminateNullValues - : true->all null results from the element transformer will be discarded and not inserted into the result list.
transform(Collection, ElementTransformer)public static <E> List<E> mergeAll(Collection<E>... collections)
Collection instances into one single List instance which keeps the order of
the elements.
E - collections -
mergeAll(Collection)public static <E> List<E> mergeAll(Collection<? extends Collection<E>> collections)
Collection instances into one single List instance which keeps the order of
the elements.
E - collections -
mergeAll(Collection...)public static <E> E lastElementOf(List<E> list)
List. Returns null if the list is null or empty.
list -
public static <E> E lastElementOf(List<E> list,
int reverseIndexPosition)
List at the given reverse index position which is counted beginning from the last
element. This means the last element has the reversed index position 0. Returns null if the list is null or empty.
list - reverseIndexPosition -
public static <E> List<E> intersection(Collection<? extends Collection<E>> listCollection)
List with only this elements which are in all of the given Lists
listCollection -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||