|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object eu.lindenbaum.maven.util.CollectionUtils
public final class CollectionUtils
Containing utilities related to collections.
Nested Class Summary | |
---|---|
static interface |
CollectionUtils.FoldFunction<A,B>
Function that returns a value of type B for an argument of type A and an accumulator argument of type B. |
static interface |
CollectionUtils.MapFunction<A,B>
Function that returns a value of type B for an argument of type A. |
Constructor Summary | |
---|---|
CollectionUtils()
|
Method Summary | ||
---|---|---|
static
|
filter(Predicate<A> p,
Collection<A> as)
Returns the Collection of elements satisfying a given predicate. |
|
static
|
foldl(CollectionUtils.FoldFunction<A,B> f,
B initial,
Collection<A> as)
Applies a function f on each element of a collection passing through an accumulator argument which is an argument for the call to f. |
|
static
|
map(CollectionUtils.MapFunction<A,B> f,
Collection<A> as)
Maps a collection with elements of type A to a collection of type B, where the resulting elements are generated by applying the function f to each element of the given collection. |
|
static
|
map(CollectionUtils.MapFunction<com.ericsson.otp.erlang.OtpErlangObject,B> f,
com.ericsson.otp.erlang.OtpErlangList as)
Maps an OtpErlangList with elements of type OtpErlangObject
to a collection of type B, where the resulting elements are generated by
applying the function f to each element of the given collection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CollectionUtils()
Method Detail |
---|
public static <A,B> Collection<B> map(CollectionUtils.MapFunction<A,B> f, Collection<A> as)
f
- the function for generating elementsas
- the original collection
public static <B> Collection<B> map(CollectionUtils.MapFunction<com.ericsson.otp.erlang.OtpErlangObject,B> f, com.ericsson.otp.erlang.OtpErlangList as)
OtpErlangList
with elements of type OtpErlangObject
to a collection of type B, where the resulting elements are generated by
applying the function f to each element of the given collection.
f
- the function for generating elementsas
- the original list
public static <A> Collection<A> filter(Predicate<A> p, Collection<A> as)
Collection
of elements satisfying a given predicate.
The input collection is not modified.
p
- the predicate for testing elementsas
- the original collection
public static <A,B> B foldl(CollectionUtils.FoldFunction<A,B> f, B initial, Collection<A> as)
f
- the function generating resultsinitial
- the start argument for the fold operationas
- the collection to iterate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |