|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CollectionUtils
Collection utilities.
| Method Summary | ||
|---|---|---|
|
foldl(F2<T2,T1,T2> f,
T2 initial,
Collection<? extends T1> collection)
Left-associative fold function. |
|
|
forAllDo(Collection<? extends T> collection,
Closure<T> closure)
Executes the specified Closure on all elements of the
Collection. |
|
|
forAllDoSynchronized(Collection<? extends T> collection,
Closure<T> closure)
Executes the specified Closure on all elements of the
Collection. |
|
|
map(Collection<? extends T1> collection,
F1<T1,T2> f)
Maps the items in a collection using a given function. |
|
|
matchesAll(Collection<? extends T> elements,
Predicate<T> pred)
Checks to see if all of the elements of the given Collection
matches the predicate. |
|
|
matchesAny(Collection<? extends T> elements,
Predicate<T> pred)
Checks to see if any of the elements of the given Collection
matches the predicate. |
|
|
select(Collection<? extends T> collection,
Predicate<T> predicate)
Returns a collection of all of the elements in a given collection that satisfy a given predicate. |
|
|
select(Collection<? extends T> collection,
Predicate<T> predicate,
Collection<T> result)
Adds all of the elements in a given collection that satisfy a given predicate to another given collection. |
|
|
selectFirst(Collection<? extends T> collection,
Predicate<T> pred)
Selects the first element matching the desired criteria, or null if no matching element exists. |
|
|
selectFirstSynchronized(Collection<? extends T> collection,
Predicate<T> pred)
Selects the first element matching the desired criteria, or null if no matching element exists. |
|
long |
sum(Collection<Long> c)
Returns the sum of a collection of long integers. |
|
|
synchronizedMatchesAny(Collection<? extends T> elements,
Predicate<T> pred)
Checks to see if any of the elements of the given Collection
matches the predicate. |
|
| Method Detail |
|---|
<T> void select(Collection<? extends T> collection,
Predicate<T> predicate,
Collection<T> result)
T - The type of objects in the collection and expected by the predicate.collection - The collection.predicate - The predicate used to evaluate each element.result - The collection to which to add the elements that satisfy the
predicate.
<T> Collection<T> select(Collection<? extends T> collection,
Predicate<T> predicate)
T - The type of objects in the collection and expected by the predicate.collection - The collection.predicate - The predicate used to evaluate each element.
<T1,T2> Collection<T2> map(Collection<? extends T1> collection,
F1<T1,T2> f)
T1 - The type of elements in the original collection.T2 - The type to which we are mapping.collection - The collection to map.f - The mapping function.
<T1,T2> T2 foldl(F2<T2,T1,T2> f,
T2 initial,
Collection<? extends T1> collection)
T1 - The type of the collection over which to fold.T2 - The type returned by the folding function.f - The folding function.initial - The initial value for folding.collection - The collection.
long sum(Collection<Long> c)
c - The collection of long integers.
<T> void forAllDo(Collection<? extends T> collection,
Closure<T> closure)
Closure on all elements of the
Collection.
T - The type of elements in the Collection.collection - The Collection with elements to perform the
closure on.closure - The Closure to execute on each element.
<T> void forAllDoSynchronized(Collection<? extends T> collection,
Closure<T> closure)
Closure on all elements of the
Collection. Also synchronizes on the Collection.
T - The type of elements in the Collection.collection - The Collection with elements to perform the
closure on.closure - The Closure to execute on each element.
<T> boolean matchesAny(Collection<? extends T> elements,
Predicate<T> pred)
Collection
matches the predicate.
T - The type of elements in the Collection.elements - The Collection to check.pred - The Predicate determining if an element matches.
true if there's any element in the
Collection matching the desired criteria.
<T> boolean matchesAll(Collection<? extends T> elements,
Predicate<T> pred)
Collection
matches the predicate.
T - The type of elements in the Collection.elements - The Collection to check.pred - The Predicate determining if all elements match.
true if all elements in the
Collection match the desired criteria.
<T> boolean synchronizedMatchesAny(Collection<? extends T> elements,
Predicate<T> pred)
Collection
matches the predicate. Synchronizes on the Collection.
T - The type of elements in the Collection.elements - The Collection to check.pred - The Predicate determining if an element matches.
true if there's any element in the
Collection matching the desired criteria.
<T> T selectFirst(Collection<? extends T> collection,
Predicate<T> pred)
null if no matching element exists. Synchronizes on the
Collection.
T - The type of elements in the Collection.collection - The Collection of elements to search.pred - The Predicate determining a match.
null if no
such element exists.
<T> T selectFirstSynchronized(Collection<? extends T> collection,
Predicate<T> pred)
null if no matching element exists. Synchronizes on the
Collection.
T - The type of elements in the Collection.collection - The Collection of elements to search.pred - The Predicate determining a match.
null if no
such element exists.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||