public final class Functions extends Object
| Modifier and Type | Method and Description |
|---|---|
static <A,B> B |
foldLeft(BiFunction<A,B,B> accumulator,
B b,
List<A> list) |
static <A,B> B |
foldRight(BiFunction<A,B,B> accumulator,
B b,
List<A> list) |
static <A> A |
head(List<A> list) |
static <A> List<A> |
tail(List<A> list) |
public static <A,B> B foldRight(BiFunction<A,B,B> accumulator, B b, List<A> list)
A - aB - baccumulator - accumulatorb - blist - listExample:
: f
/ \ foldRight f z -> / \
1 : 1 f
/ \ / \
2 [] 2 z
public static <A,B> B foldLeft(BiFunction<A,B,B> accumulator, B b, List<A> list)
A - aB - baccumulator - accumulatorb - blist - listExample:
: f
/ \ foldLeft f z -> / \
1 : f 2
/ \ / \
2 [] z 1
public static <A> A head(List<A> list)
A - alist - listIndexOutOfBoundsException - if the list is emptypublic static <A> List<A> tail(List<A> list)
A - alist - listIndexOutOfBoundsException - if the list is emptyCopyright © 2014–2016. All rights reserved.