|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.javimmutable.collections.util.Functions
public final class Functions
Library of static functions that perform various operations on Cursors.
Method Summary | ||
---|---|---|
static
|
assignAll(JImmutableMap<K,V> dest,
JImmutableMap<K,V> src)
|
|
static
|
assignAll(JImmutableMap<K,V> dest,
Map<K,V> src)
|
|
static
|
collectAll(Cursor<? extends T> cursor,
A list,
Func1<? super T,R> func)
Calls func for every value in cursor and adds each value returned by func to a list. |
|
static
|
collectSome(Cursor<? extends T> cursor,
A list,
Func1<? super T,Holder<R>> func)
Calls func for every value in cursor and adds each value for which func returns a non-empty Holder to a list. |
|
static
|
each(Cursor<T> cursor)
Returns an Iterable that can be used to navigate each element in the specified Cursor. |
|
static
|
each(Cursorable<T> cursorable)
Returns an Iterable that can be used to navigate each element in the specified Cursorable. |
|
static
|
find(Cursor<? extends T> cursor,
Func1<? super T,Boolean> func)
Calls func for each value in cursor and passes it to func until func returns true. |
|
static
|
foldLeft(R accumulator,
Cursor<? extends T> cursor,
Func2<R,? super T,R> func)
Calls func for every value in cursor passing in the accumulator and each value as parameters and setting accumulator to the result. |
|
static
|
foldRight(R accumulator,
Cursor<? extends T> cursor,
Func2<R,? super T,R> func)
Calls func for every value in cursor from right to left (i.e. |
|
static
|
insertAll(A addable,
Cursor<? extends T> cursor)
Add all values form the cursor to the addable. |
|
static
|
insertAll(A addable,
Iterator<? extends T> iterator)
Add all values form the iterator to the addable. |
|
static
|
insertAll(A addable,
T[] values)
Add all values form the array to the addable. |
|
static
|
reject(Cursor<? extends T> cursor,
A list,
Func1<? super T,Boolean> func)
Calls func for every value in cursor and adds each value for which func returns false to a list. |
|
static
|
reverse(Cursor<? extends T> cursor)
Creates a new Cursor whose values are in the reverse order of the provided Cursor. |
|
static
|
select(Cursor<? extends T> cursor,
A list,
Func1<? super T,Boolean> func)
Calls func for every value in cursor and adds each value for which func returns true to a list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T,R> R foldLeft(R accumulator, Cursor<? extends T> cursor, Func2<R,? super T,R> func)
accumulator
- cursor
- func
-
public static <T,R> R foldRight(R accumulator, Cursor<? extends T> cursor, Func2<R,? super T,R> func)
T
- R
- accumulator
- func
- cursor
-
public static <T> Cursor<T> reverse(Cursor<? extends T> cursor)
T
- cursor
-
public static <T,R,A extends Insertable<R>> A collectAll(Cursor<? extends T> cursor, A list, Func1<? super T,R> func)
T
- cursor
- source of the valuesfunc
- function to transform the valueslist
- list to receive the values
public static <T,R,A extends Insertable<R>> A collectSome(Cursor<? extends T> cursor, A list, Func1<? super T,Holder<R>> func)
T
- cursor
- source of the valuesfunc
- function to reject the valueslist
- list to receive the values
public static <T> Holder<T> find(Cursor<? extends T> cursor, Func1<? super T,Boolean> func)
T
- cursor
- func
-
public static <T,A extends Insertable<T>> A reject(Cursor<? extends T> cursor, A list, Func1<? super T,Boolean> func)
T
- cursor
- source of the valuesfunc
- function to reject the valueslist
- list to receive the values
public static <T,A extends Insertable<T>> A select(Cursor<? extends T> cursor, A list, Func1<? super T,Boolean> func)
cursor
- source of the valuesfunc
- function to select the valueslist
- list to receive the values
public static <T,A extends Insertable<T>> A insertAll(A addable, Iterator<? extends T> iterator)
iterator
-
public static <T,A extends Insertable<T>> A insertAll(A addable, Cursor<? extends T> cursor)
cursor
-
public static <T,A extends Insertable<T>> A insertAll(A addable, T[] values)
values
-
public static <K,V> JImmutableMap<K,V> assignAll(JImmutableMap<K,V> dest, JImmutableMap<K,V> src)
public static <K,V> JImmutableMap<K,V> assignAll(JImmutableMap<K,V> dest, Map<K,V> src)
public static <T> Iterable<T> each(Cursor<T> cursor)
T
- cursor
-
public static <T> Iterable<T> each(Cursorable<T> cursorable)
T
- cursorable
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |