public abstract class List<A>
extends java.lang.Object
implements java.lang.Iterable<A>
Modifier and Type | Class and Description |
---|---|
static class |
List.Buffer<A>
A mutable, singly linked list.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allEqual(Equal<A> eq)
Returns whether or not all elements in the list are equal according to the given equality test.
|
List<A> |
append(List<A> as)
Appends the given list to this list.
|
<B> List<B> |
apply(List<F<A,B>> lf)
Performs function application within a list (applicative functor pattern).
|
A[] |
array(java.lang.Class<A[]> c)
Returns an array from this list.
|
static F<List<java.lang.Character>,java.lang.String> |
asString()
A first-class
asString . |
static java.lang.String |
asString(List<java.lang.Character> cs)
Returns a string from the given list of characters.
|
static <A,B> F<F<A,List<B>>,F<List<A>,List<B>>> |
bind_()
Provides a first-class version of bind()
|
<B> List<B> |
bind(F<A,List<B>> f)
Binds the given function across each element of this list with a final join.
|
<B,C> List<C> |
bind(List<B> lb,
F<A,F<B,C>> f)
Binds the given function across each element of this list and the given list with a final
join.
|
<B,C> List<C> |
bind(List<B> lb,
F2<A,B,C> f)
Binds the given function across each element of this list and the given list with a final
join.
|
<B,C,D> List<D> |
bind(List<B> lb,
List<C> lc,
F<A,F<B,F<C,D>>> f)
Binds the given function across each element of this list and the given lists with a final
join.
|
<B,C,D,E> List<E> |
bind(List<B> lb,
List<C> lc,
List<D> ld,
F<A,F<B,F<C,F<D,E>>>> f)
Binds the given function across each element of this list and the given lists with a final
join.
|
<B,C,D,E,F$> |
bind(List<B> lb,
List<C> lc,
List<D> ld,
List<E> le,
F<A,F<B,F<C,F<D,F<E,F$>>>>> f)
Binds the given function across each element of this list and the given lists with a final
join.
|
<B,C,D,E,F$,G> |
bind(List<B> lb,
List<C> lc,
List<D> ld,
List<E> le,
List<F$> lf,
F<A,F<B,F<C,F<D,F<E,F<F$,G>>>>>> f)
Binds the given function across each element of this list and the given lists with a final
join.
|
<B,C,D,E,F$,G,H> |
bind(List<B> lb,
List<C> lc,
List<D> ld,
List<E> le,
List<F$> lf,
List<G> lg,
F<A,F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>>> f)
Binds the given function across each element of this list and the given lists with a final
join.
|
<B,C,D,E,F$,G,H,I> |
bind(List<B> lb,
List<C> lc,
List<D> ld,
List<E> le,
List<F$> lf,
List<G> lg,
List<H> lh,
F<A,F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>>> f)
Binds the given function across each element of this list and the given lists with a final
join.
|
P2<List<A>,List<A>> |
breakk(F<A,java.lang.Boolean> p)
Returns a tuple where the first element is the longest prefix of this list that does not satisfy
the given predicate and the second element is the remainder of the list.
|
static <A> F<List<A>,List<A>> |
cons_(A a)
Returns a function that prepends the given value to a list.
|
static <A> F<A,F<List<A>,List<A>>> |
cons()
Returns a function that prepends (cons) an element to a list to produce a new list.
|
List<A> |
cons(A a)
Prepends (cons) the given element to this list to product a new list.
|
static <A> List<A> |
cons(A head,
List<A> tail)
Prepends the given head element to the given tail element to produce a new list.
|
static <A> F<A,List<A>> |
cons(List<A> tail)
Returns a function that prepends a value to the given list.
|
List<A> |
conss(A a)
Prepends (cons) the given element to this list to product a new list.
|
List<A> |
delete(A a,
Equal<A> e)
Removes the first element that equals the given object.
|
List<A> |
drop(int i)
Drops the given number of elements from the head of this list if they are available.
|
List<A> |
dropWhile(F<A,java.lang.Boolean> f)
Removes elements from the head of this list that do not match the given predicate function
until an element is found that does match or the list is exhausted.
|
Option<java.lang.Integer> |
elementIndex(Equal<A> e,
A a)
Returns the index of the first element in this list which is equal (by the given equality) to the
query element, or None if there is no such element.
|
boolean |
equals(java.lang.Object obj)
Perform an equality test on this list which delegates to the .equals() method of the member instances.
|
boolean |
exists(F<A,java.lang.Boolean> f)
Returns
true if the predicate holds for at least one of the elements of this list,
false otherwise (false for the empty list). |
List<A> |
filter(F<A,java.lang.Boolean> f)
Filters elements from this list by returning only elements which produce
true when
the given function is applied to them. |
Option<A> |
find(F<A,java.lang.Boolean> f)
Finds the first occurrence of an element that matches the given predicate or no value if no
elements match.
|
static <A,B> F<F<B,F<A,B>>,F<B,F<List<A>,B>>> |
foldLeft()
Provides a first-class version of foldLeft.
|
<B> B |
foldLeft(F<B,F<A,B>> f,
B b)
Performs a left-fold reduction across this list.
|
<B> B |
foldLeft(F2<B,A,B> f,
B b)
Performs a left-fold reduction across this list.
|
A |
foldLeft1(F<A,F<A,A>> f)
Takes the first 2 elements of the list and applies the function to them,
then applies the function to the result and the third element and so on.
|
A |
foldLeft1(F2<A,A,A> f)
Takes the first 2 elements of the list and applies the function to them,
then applies the function to the result and the third element and so on.
|
<B> B |
foldRight(F<A,F<B,B>> f,
B b)
Performs a right-fold reduction across this list.
|
<B> B |
foldRight(F2<A,B,B> f,
B b)
Performs a right-fold reduction across this list.
|
<B> Trampoline<B> |
foldRightC(F2<A,B,B> f,
B b)
Performs a right-fold reduction across this list in O(1) stack space.
|
boolean |
forall(F<A,java.lang.Boolean> f)
Returns
true if the predicate holds for all of the elements of this list,
false otherwise (true for the empty list). |
void |
foreach(Effect<A> f)
Performs a side-effect for each element of this list.
|
Unit |
foreach(F<A,Unit> f)
Performs a side-effect for each element of this list.
|
static F<java.lang.String,List<java.lang.Character>> |
fromString()
A first-class
fromString . |
static List<java.lang.Character> |
fromString(java.lang.String s)
Returns a list of characters from the given string.
|
List<List<A>> |
group(Equal<A> e)
Groups elements according to the given equality implementation.
|
int |
hashCode()
Compute the hash code from this list as a function of the hash codes of its members.
|
static <A> F<List<A>,A> |
head_()
First-class head function.
|
abstract A |
head()
The first element of the linked list or fails for the empty list.
|
A |
index(int i)
Returns the element at the given index if it exists, fails otherwise.
|
List<A> |
init()
Returns all but the last element of this list.
|
List<List<A>> |
inits()
Returns the list of initial segments of this list, shortest first.
|
List<A> |
insertBy(F<A,F<A,Ordering>> f,
A x)
Inserts the given element before the first element that is greater than or equal to it according
to the given ordering.
|
List<A> |
intercalate(List<List<A>> as)
Intersperses this list through the given list then joins the results.
|
List<A> |
intersperse(A a)
Intersperses the given argument between each element of this list.
|
static <A> F<List<A>,java.lang.Boolean> |
isEmpty_()
Returns a function that determines whether a given list is empty.
|
boolean |
isEmpty()
Returns
true if this list is empty, false otherwise. |
static <A> F<List<A>,java.lang.Boolean> |
isNotEmpty_()
Returns a function that determines whether a given list is not empty.
|
boolean |
isNotEmpty()
Returns
false if this list is empty, true otherwise. |
static <A> List<A> |
iterableList(java.lang.Iterable<A> i)
Takes the given iterable to a list.
|
static <A> List<A> |
iterateWhile(F<A,A> f,
F<A,java.lang.Boolean> p,
A a)
Creates a list where the first item is calculated by applying the function on the third argument,
the second item by applying the function on the previous result and so on.
|
java.util.Iterator<A> |
iterator()
Returns an iterator for this list.
|
static <A> F<List<List<A>>,List<A>> |
join()
A first-class version of join
|
static <A> List<A> |
join(List<List<A>> o)
Joins the given list of lists using a bind operation.
|
A |
last()
Returns the last element of this list.
|
static <A> F<List<A>,java.lang.Integer> |
length_()
First-class length.
|
int |
length()
The length of this list.
|
static <A,B,C> F<List<A>,F<List<B>,List<C>>> |
liftM2(F<A,F<B,C>> f)
Promotes the given function of arity-2 to a function on lists.
|
static <A> List<A> |
list(A... as)
Constructs a list from the given elements.
|
<B> B |
list(B nil,
F<A,F<List<A>,B>> cons)
Performs a reduction on this list using the given arguments.
|
static <A,B> F2<List<P2<A,B>>,A,Option<B>> |
lookup(Equal<A> e)
Returns a partially applied version of
lookup(Equal, List, Object) . |
static <A,B> Option<B> |
lookup(Equal<A> e,
List<P2<A,B>> x,
A a)
Returns an associated value with the given key in the list of pairs.
|
static <A,B> F<F<A,B>,F<List<A>,List<B>>> |
map_()
Provides a first-class version of map()
|
<B> List<B> |
map(F<A,B> f)
Maps the given function across this list.
|
<B,C> F<B,List<C>> |
mapM(F<A,F<B,C>> f)
Maps the given function of arity-2 across this list and returns a function that applies all the resulting
functions to a given argument.
|
<B> Option<List<B>> |
mapMOption(F<A,Option<B>> f)
Maps the given function across this list by binding through the Option monad.
|
<B> Trampoline<List<B>> |
mapMTrampoline(F<A,Trampoline<B>> f)
Maps the given function across this list by binding through the Trampoline monad.
|
A |
maximum(Ord<A> o)
Returns the maximum element in this list according to the given ordering.
|
A |
minimum(Ord<A> o)
Returns the minimum element in this list according to the given ordering.
|
List<A> |
minus(Equal<A> eq,
List<A> xs)
Returns a new list of all the items in this list that do not appear in the given list.
|
A |
mode(Ord<A> o)
Returns the most common element in this list.
|
static <A> List<A> |
nil()
Returns an empty list.
|
List<A> |
nub()
Removes duplicates according to object equality.
|
List<A> |
nub(Equal<A> eq)
Removes duplicates according to the given equality.
|
List<A> |
nub(Ord<A> o)
Removes duplicates according to the given ordering.
|
A |
orHead(P1<A> a)
Returns the head of this list if there is one or the given argument if this list is empty.
|
List<A> |
orTail(P1<List<A>> as)
Returns the tail of this list if there is one or the given argument if this list is empty.
|
List<List<A>> |
partition(int n)
Splits this list into lists of the given size.
|
static List<java.lang.Integer> |
range(int from,
int to)
Returns a list of integers from the given
from value (inclusive) to the given
to value (exclusive). |
List<A> |
removeAll(F<A,java.lang.Boolean> f)
Filters elements from this list by returning only elements which produce
false when
the given function is applied to them. |
static <A> List<A> |
replicate(int n,
A a)
Returns a list of the given value replicated the given number of times.
|
List<A> |
reverse()
Reverse this list in constant stack space.
|
static <A,B> F<B,List<A>> |
sequence_(List<F<B,A>> fs)
Turn a list of functions into a function returning a list.
|
<B> List<B> |
sequence(List<B> bs)
Performs a bind across each list element, but ignores the element value each time.
|
static <A> List<A> |
single(A a)
Returns a list of one element containing the given value.
|
List<A> |
snoc(A a)
Appends (snoc) the given element to this list to produce a new list.
|
List<A> |
sort(Ord<A> o)
Sorts this list using the given order over elements using a merge sort algorithm.
|
P2<List<A>,List<A>> |
span(F<A,java.lang.Boolean> p)
Returns a tuple where the first element is the longest prefix of this list that satisfies
the given predicate and the second element is the remainder of the list.
|
P2<List<A>,List<A>> |
splitAt(int i)
Splits this list into two lists at the given index.
|
static <A> F<List<A>,List<A>> |
tail_()
First-class tail function.
|
abstract List<A> |
tail()
The list without the first element or fails for the empty list.
|
List<List<A>> |
tails()
Returns the list of final segments of this list, longest first.
|
static <A> F<java.lang.Integer,F<List<A>,List<A>>> |
take()
Provides a first-class version of take.
|
List<A> |
take(int i)
Takes the given number of elements from the head of this list if they are available.
|
List<A> |
takeWhile(F<A,java.lang.Boolean> f)
Returns the first elements of the head of this list that match the given predicate function.
|
Array<A> |
toArray()
Returns a array projection of this list.
|
Array<A> |
toArray(java.lang.Class<A[]> c)
Returns a array projection of this list.
|
java.util.Collection<A> |
toCollection()
Projects an immutable collection of this list.
|
<X> Either<X,A> |
toEither(P1<X> x)
Returns an either projection of this list; the given argument in
Left if empty, or
the first element in Right . |
Option<A> |
toOption()
Returns an option projection of this list;
None if empty, or the first element in
Some . |
Stream<A> |
toStream()
Returns a stream projection of this list.
|
java.lang.String |
toString()
Obtain a string representation of this list using the toString implementations of the members.
|
static <A,B> List<A> |
unfold(F<B,Option<P2<A,B>>> f,
B b)
Unfolds across the given function starting at the given value to produce a list.
|
static <A,B> P2<List<A>,List<B>> |
unzip(List<P2<A,B>> xs)
Transforms a list of pairs into a list of first components and a list of second components.
|
static <A,B> F<List<A>,F<List<B>,List<P2<A,B>>>> |
zip()
The first-class version of the zip function.
|
<B> List<P2<A,B>> |
zip(List<B> bs)
Zips this list with the given list to produce a list of pairs.
|
List<P2<A,java.lang.Integer>> |
zipIndex()
Zips this list with the index of its element as a pair.
|
static <A,B,C> F<List<A>,F<List<B>,F<F<A,F<B,C>>,List<C>>>> |
zipWith()
Provides a first-class version of zipWith
|
<B,C> List<C> |
zipWith(List<B> bs,
F<A,F<B,C>> f)
Zips this list with the given list using the given function to produce a new list.
|
<B,C> List<C> |
zipWith(List<B> bs,
F2<A,B,C> f)
Zips this list with the given list using the given function to produce a new list.
|
public final java.util.Iterator<A> iterator()
for
-each loop.iterator
in interface java.lang.Iterable<A>
public abstract A head()
public abstract List<A> tail()
public final int length()
public final boolean isEmpty()
true
if this list is empty, false
otherwise.true
if this list is empty, false
otherwise.public final boolean isNotEmpty()
false
if this list is empty, true
otherwise.false
if this list is empty, true
otherwise.public final <B> B list(B nil, F<A,F<List<A>,B>> cons)
nil
- The value to return if this list is empty.cons
- The function to apply to the head and tail of this list if it is not empty.public final A orHead(P1<A> a)
a
- The argument to return if this list is empty.public final List<A> orTail(P1<List<A>> as)
as
- The argument to return if this list is empty.public final Option<A> toOption()
None
if empty, or the first element in
Some
.public final <X> Either<X,A> toEither(P1<X> x)
Left
if empty, or
the first element in Right
.x
- The value to return in left if this list is empty.public final Stream<A> toStream()
public final Array<A> toArray()
public final Array<A> toArray(java.lang.Class<A[]> c)
c
- The class type of the array to return.public final A[] array(java.lang.Class<A[]> c)
c
- The class type of the array to return.public final List<A> cons(A a)
a
- The element to prepend.public final List<A> conss(A a)
a
- The element to prepend.public final <B> List<B> map(F<A,B> f)
f
- The function to map across this list.public final Unit foreach(F<A,Unit> f)
f
- The side-effect to perform for the given element.public final void foreach(Effect<A> f)
f
- The side-effect to perform for the given element.public final List<A> filter(F<A,java.lang.Boolean> f)
true
when
the given function is applied to them.f
- The predicate function to filter on.public final List<A> removeAll(F<A,java.lang.Boolean> f)
false
when
the given function is applied to them.f
- The predicate function to filter on.public final List<A> delete(A a, Equal<A> e)
removeAll(e.eq(a))
a
- The element to removee
- An Equals
instance for the element's type.public final List<A> takeWhile(F<A,java.lang.Boolean> f)
f
- The predicate function to apply on this list until it finds an element that does not
hold, or the list is exhausted.public final List<A> dropWhile(F<A,java.lang.Boolean> f)
f
- The predicate function to apply through this list.public final P2<List<A>,List<A>> span(F<A,java.lang.Boolean> p)
p
- A predicate to be satisfied by a prefix of this list.public final P2<List<A>,List<A>> breakk(F<A,java.lang.Boolean> p)
p
- A predicate for an element to not satisfy by a prefix of this list.public final List<List<A>> group(Equal<A> e)
e
- The equality implementation for the elements.public final <B> List<B> bind(F<A,List<B>> f)
f
- The function to apply to each element of this list.public final <B,C> List<C> bind(List<B> lb, F<A,F<B,C>> f)
lb
- A given list to bind the given function with.f
- The function to apply to each element of this list and the given list.public final <B,C> List<C> bind(List<B> lb, F2<A,B,C> f)
lb
- A given list to bind the given function with.f
- The function to apply to each element of this list and the given list.public static <A,B,C> F<List<A>,F<List<B>,List<C>>> liftM2(F<A,F<B,C>> f)
f
- The function to promote to a function on lists.public final <B,C,D> List<D> bind(List<B> lb, List<C> lc, F<A,F<B,F<C,D>>> f)
lb
- A given list to bind the given function with.lc
- A given list to bind the given function with.f
- The function to apply to each element of this list and the given lists.public final <B,C,D,E> List<E> bind(List<B> lb, List<C> lc, List<D> ld, F<A,F<B,F<C,F<D,E>>>> f)
lb
- A given list to bind the given function with.lc
- A given list to bind the given function with.ld
- A given list to bind the given function with.f
- The function to apply to each element of this list and the given lists.public final <B,C,D,E,F$> List<F$> bind(List<B> lb, List<C> lc, List<D> ld, List<E> le, F<A,F<B,F<C,F<D,F<E,F$>>>>> f)
lb
- A given list to bind the given function with.lc
- A given list to bind the given function with.ld
- A given list to bind the given function with.le
- A given list to bind the given function with.f
- The function to apply to each element of this list and the given lists.public final <B,C,D,E,F$,G> List<G> bind(List<B> lb, List<C> lc, List<D> ld, List<E> le, List<F$> lf, F<A,F<B,F<C,F<D,F<E,F<F$,G>>>>>> f)
lb
- A given list to bind the given function with.lc
- A given list to bind the given function with.ld
- A given list to bind the given function with.le
- A given list to bind the given function with.lf
- A given list to bind the given function with.f
- The function to apply to each element of this list and the given lists.public final <B,C,D,E,F$,G,H> List<H> bind(List<B> lb, List<C> lc, List<D> ld, List<E> le, List<F$> lf, List<G> lg, F<A,F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>>> f)
lb
- A given list to bind the given function with.lc
- A given list to bind the given function with.ld
- A given list to bind the given function with.le
- A given list to bind the given function with.lf
- A given list to bind the given function with.lg
- A given list to bind the given function with.f
- The function to apply to each element of this list and the given lists.public final <B,C,D,E,F$,G,H,I> List<I> bind(List<B> lb, List<C> lc, List<D> ld, List<E> le, List<F$> lf, List<G> lg, List<H> lh, F<A,F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>>> f)
lb
- A given list to bind the given function with.lc
- A given list to bind the given function with.ld
- A given list to bind the given function with.le
- A given list to bind the given function with.lf
- A given list to bind the given function with.lg
- A given list to bind the given function with.lh
- A given list to bind the given function with.f
- The function to apply to each element of this list and the given lists.public final <B> List<B> sequence(List<B> bs)
bs
- The list to apply in the final join.public final <B> List<B> apply(List<F<A,B>> lf)
lf
- The list of functions to apply.public final List<A> append(List<A> as)
as
- The list to append to this one.public final <B> B foldRight(F<A,F<B,B>> f, B b)
f
- The function to apply on each element of the list.b
- The beginning value to start the application from.public final <B> B foldRight(F2<A,B,B> f, B b)
f
- The function to apply on each element of the list.b
- The beginning value to start the application from.public final <B> Trampoline<B> foldRightC(F2<A,B,B> f, B b)
f
- The function to apply on each element of the list.b
- The beginning value to start the application from.public final <B> B foldLeft(F<B,F<A,B>> f, B b)
f
- The function to apply on each element of the list.b
- The beginning value to start the application from.public final <B> B foldLeft(F2<B,A,B> f, B b)
f
- The function to apply on each element of the list.b
- The beginning value to start the application from.public final A foldLeft1(F2<A,A,A> f)
f
- The function to apply on each element of the list.public final A foldLeft1(F<A,F<A,A>> f)
f
- The function to apply on each element of the list.public final List<A> reverse()
public final A index(int i)
i
- The index at which to get the element to return.public final List<A> take(int i)
i
- The maximum number of elements to take from this list.public final List<A> drop(int i)
i
- The number of elements to drop from the head of this list.public final P2<List<A>,List<A>> splitAt(int i)
i
- The index at which to split this list in two parts.public final List<List<A>> partition(int n)
n
- The size of the partitions into which to split this list.public final List<List<A>> inits()
public final List<List<A>> tails()
public final List<A> sort(Ord<A> o)
o
- The order over the elements of this list.public final <B,C> List<C> zipWith(List<B> bs, F<A,F<B,C>> f)
bs
- The list to zip this list with.f
- The function to zip this list and the given list with.public final <B,C> List<C> zipWith(List<B> bs, F2<A,B,C> f)
bs
- The list to zip this list with.f
- The function to zip this list and the given list with.public static <A,B,C> F<List<A>,F<List<B>,F<F<A,F<B,C>>,List<C>>>> zipWith()
public final <B> List<P2<A,B>> zip(List<B> bs)
bs
- The list to zip this list with.public static <A,B> F<List<A>,F<List<B>,List<P2<A,B>>>> zip()
public final List<P2<A,java.lang.Integer>> zipIndex()
public final List<A> snoc(A a)
a
- The element to append to this list.public final boolean forall(F<A,java.lang.Boolean> f)
true
if the predicate holds for all of the elements of this list,
false
otherwise (true
for the empty list).f
- The predicate function to test on each element of this list.true
if the predicate holds for all of the elements of this list,
false
otherwise.public final boolean exists(F<A,java.lang.Boolean> f)
true
if the predicate holds for at least one of the elements of this list,
false
otherwise (false
for the empty list).f
- The predicate function to test on the elements of this list.true
if the predicate holds for at least one of the elements of this
list.public final Option<A> find(F<A,java.lang.Boolean> f)
f
- The predicate function to test on elements of this list.public final List<A> intersperse(A a)
a
- The separator to intersperse in this list.public final List<A> intercalate(List<List<A>> as)
as
- The list to intersperse through.public final List<A> nub()
public final List<A> nub(Equal<A> eq)
eq
- Equality over the elements.public final List<A> nub(Ord<A> o)
o
- An ordering for the elements.public static <A> F<List<A>,A> head_()
public static <A> F<List<A>,List<A>> tail_()
public final List<A> minus(Equal<A> eq, List<A> xs)
eq
- an equality for the items of the lists.xs
- a list to subtract from this list.public final <B,C> F<B,List<C>> mapM(F<A,F<B,C>> f)
f
- A function of arity-2public final <B> Option<List<B>> mapMOption(F<A,Option<B>> f)
f
- The function to apply through the this list.public final <B> Trampoline<List<B>> mapMTrampoline(F<A,Trampoline<B>> f)
f
- The function to apply through the this list.public final Option<java.lang.Integer> elementIndex(Equal<A> e, A a)
e
- An equality for this list's elements.a
- A query element.public final A last()
public final List<A> init()
public final List<A> insertBy(F<A,F<A,Ordering>> f, A x)
f
- An ordering function to compare elements.x
- The element to insert.public final A mode(Ord<A> o)
o
- An ordering for the elements of the list.public boolean allEqual(Equal<A> eq)
eq
- The equality test.public static <A> F<List<A>,java.lang.Integer> length_()
public final A maximum(Ord<A> o)
o
- An ordering for the elements of the list.public final A minimum(Ord<A> o)
o
- An ordering for the elements of the list.public final java.util.Collection<A> toCollection()
public static <A> List<A> list(A... as)
as
- The elements to construct a list with.public static <A> List<A> nil()
public static <A> F<A,F<List<A>,List<A>>> cons()
public static <A> F<A,List<A>> cons(List<A> tail)
tail
- The list to prepend to.public static <A> F<List<A>,List<A>> cons_(A a)
a
- The value to prepend to a list.public static <A> List<A> cons(A head, List<A> tail)
head
- The element to prepend.tail
- The list to prepend to.public static <A> F<List<A>,java.lang.Boolean> isEmpty_()
public static <A> F<List<A>,java.lang.Boolean> isNotEmpty_()
public static <A> List<A> join(List<List<A>> o)
o
- The list of lists to join.public static <A> F<List<List<A>>,List<A>> join()
public static <A,B> List<A> unfold(F<B,Option<P2<A,B>>> f, B b)
f
- The function to unfold across.b
- The start value to begin the unfold.public static <A,B> P2<List<A>,List<B>> unzip(List<P2<A,B>> xs)
xs
- The list of pairs to transform.sppublic static <A> List<A> replicate(int n, A a)
n
- The number of times to replicate the given value.a
- The value to replicate.public static List<java.lang.Integer> range(int from, int to)
from
value (inclusive) to the given
to
value (exclusive).from
- The minimum value for the list (inclusive).to
- The maximum value for the list (exclusive).from
value (inclusive) to the given
to
value (exclusive).public static List<java.lang.Character> fromString(java.lang.String s)
asString(List)
.s
- The string to produce the list of characters from.public static F<java.lang.String,List<java.lang.Character>> fromString()
fromString
.fromString
.public static java.lang.String asString(List<java.lang.Character> cs)
fromString(String)
.cs
- The list of characters to produce the string from.public static F<List<java.lang.Character>,java.lang.String> asString()
asString
.asString
.public static <A> List<A> single(A a)
a
- The value for the head of the returned list.public static <A> List<A> iterateWhile(F<A,A> f, F<A,java.lang.Boolean> p, A a)
f
- The function to iterate with.p
- The predicate which must be true for the next item in order to continue the iteration.a
- The input to the first iteration.public static <A,B> Option<B> lookup(Equal<A> e, List<P2<A,B>> x, A a)
e
- The test for equality on keys.x
- The list of pairs to search.a
- The key value to find the associated value of.public static <A,B> F2<List<P2<A,B>>,A,Option<B>> lookup(Equal<A> e)
lookup(Equal, List, Object)
.e
- The test for equality on keys.lookup(Equal , List, Object)
.public static <A,B> F<F<A,List<B>>,F<List<A>,List<B>>> bind_()
public static <A,B> F<F<A,B>,F<List<A>,List<B>>> map_()
public static <A,B> F<B,List<A>> sequence_(List<F<B,A>> fs)
fs
- The list of functions to sequence into a single function that returns a list.public static <A,B> F<F<B,F<A,B>>,F<B,F<List<A>,B>>> foldLeft()
public static <A> F<java.lang.Integer,F<List<A>,List<A>>> take()
public static <A> List<A> iterableList(java.lang.Iterable<A> i)
i
- The iterable to take to a list.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the other object to check for equality against.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object