public final class IterableW<A>
extends java.lang.Object
implements java.lang.Iterable<A>
Modifier and Type | Method and Description |
---|---|
<B> IterableW<B> |
apply(java.lang.Iterable<F<A,B>> f)
Performs function application within an iterable (applicative functor pattern).
|
static <A,B> F<F<A,B>,F<A,IterableW<B>>> |
arrow()
Provides a transformation from a function to a Iterable-valued function that is equivalent to it.
|
static <A,B,T extends java.lang.Iterable<B>> |
bind()
The first-class bind function over Iterable.
|
<B,T extends java.lang.Iterable<B>> |
bind(F<A,T> f)
Binds the given function across the wrapped Iterable with a final join.
|
static <A,B,C> IterableW<C> |
bind(java.lang.Iterable<A> a,
java.lang.Iterable<B> b,
F<A,F<B,C>> f)
Binds the given function to the values in the given iterables with a final join.
|
<B> B |
foldLeft(F<B,F<A,B>> f,
B z)
The catamorphism for Iterables, implemented as a left fold.
|
A |
foldLeft1(F<A,F<A,A>> f)
Takes the first 2 elements of the iterable 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 iterable and applies the function to them,
then applies the function to the result and the third element and so on.
|
<B> B |
foldRight(F2<A,B,B> f,
B z)
The catamorphism for Iterables, implemented as a right fold.
|
static <A> IterableW<A> |
iterable(A a)
Returns an Iterable that completely preserves the argument.
|
static <A,B> F<A,IterableW<B>> |
iterable(F<A,B> f)
Wraps a given function's return value in a Iterable.
|
java.util.Iterator<A> |
iterator()
Returns an iterator for this iterable.
|
static <A,T extends java.lang.Iterable<A>> |
join()
Returns a function that joins an Iterable of Iterables into a single Iterable.
|
static <A,T extends java.lang.Iterable<A>> |
join(java.lang.Iterable<T> as)
Joins an Iterable of Iterables into a single Iterable.
|
static <A,B,C> F<java.lang.Iterable<A>,F<java.lang.Iterable<B>,IterableW<C>>> |
liftM2(F<A,F<B,C>> f)
Promotes a function of arity-2 to a function on iterables.
|
static <A,B> F<F<A,B>,F<IterableW<A>,IterableW<B>>> |
map()
Returns a function that promotes any function so that it operates on Iterables.
|
<B> IterableW<B> |
map(F<A,B> f)
Maps a given function across the wrapped Iterable.
|
static <A,T extends java.lang.Iterable<A>> |
sequence(java.lang.Iterable<T> as)
Performs a bind across each element of all iterables of an iterable, collecting the values in an iterable.
|
java.util.List<A> |
toStandardList()
Returns a java.util.List implementation for this iterable.
|
Option<Zipper<A>> |
toZipper() |
static <A,T extends java.lang.Iterable<A>> |
wrap()
Provides a function that wraps the given iterable.
|
static <A> IterableW<A> |
wrap(java.lang.Iterable<A> a)
Wraps the given iterable.
|
<B> IterableW<B> |
zapp(java.lang.Iterable<F<A,B>> fs)
Zips this iterable with the given iterable of functions, applying each function in turn to the
corresponding element in this iterable to produce a new iterable.
|
<B> java.lang.Iterable<P2<A,B>> |
zip(java.lang.Iterable<B> bs)
Zips this iterable with the given iterable to produce a iterable of pairs.
|
java.lang.Iterable<P2<A,java.lang.Integer>> |
zipIndex()
Zips this iterable with the index of its element as a pair.
|
<B,C> java.lang.Iterable<C> |
zipWith(java.lang.Iterable<B> bs,
F<A,F<B,C>> f)
Zips this iterable with the given iterable using the given function to produce a new iterable.
|
<B,C> java.lang.Iterable<C> |
zipWith(java.lang.Iterable<B> bs,
F2<A,B,C> f)
Zips this iterable with the given iterable using the given function to produce a new iterable.
|
public static <A> IterableW<A> wrap(java.lang.Iterable<A> a)
a
- The iterable to wrap.public static <A,T extends java.lang.Iterable<A>> F<T,IterableW<A>> wrap()
public static <A> IterableW<A> iterable(A a)
a
- A value to preserve in an Iterable.public static <A,B> F<A,IterableW<B>> iterable(F<A,B> f)
f
- The function whose return value to wrap in a Iterable.public static <A,B> F<F<A,B>,F<A,IterableW<B>>> arrow()
public <B,T extends java.lang.Iterable<B>> IterableW<B> bind(F<A,T> f)
f
- A function to bind across the Iterable.public <B> IterableW<B> apply(java.lang.Iterable<F<A,B>> f)
f
- The iterable function to apply.public static <A,B,C> IterableW<C> bind(java.lang.Iterable<A> a, java.lang.Iterable<B> b, F<A,F<B,C>> f)
a
- A given iterable to bind the given function with.b
- A given iterable to bind the given function with.f
- The function to apply to the values in the given iterables.public static <A,B,C> F<java.lang.Iterable<A>,F<java.lang.Iterable<B>,IterableW<C>>> liftM2(F<A,F<B,C>> f)
f
- The function to promote.public static <A,T extends java.lang.Iterable<A>> IterableW<IterableW<A>> sequence(java.lang.Iterable<T> as)
as
- The iterable of iterables to transform.public static <A,B,T extends java.lang.Iterable<B>> F<IterableW<A>,F<F<A,T>,IterableW<B>>> bind()
public static <A,T extends java.lang.Iterable<A>> IterableW<A> join(java.lang.Iterable<T> as)
as
- An Iterable of Iterables to join.public static <A,T extends java.lang.Iterable<A>> F<java.lang.Iterable<T>,IterableW<A>> join()
public <B> IterableW<B> map(F<A,B> f)
f
- A function to map across the wrapped Iterable.public static <A,B> F<F<A,B>,F<IterableW<A>,IterableW<B>>> map()
public <B> B foldLeft(F<B,F<A,B>> f, B z)
f
- The function with which to fold the wrapped iterable.z
- The base case value of the destination type, applied first (leftmost) to the fold.public A foldLeft1(F2<A,A,A> f)
f
- The function to apply on each element of the iterable.public A foldLeft1(F<A,F<A,A>> f)
f
- The function to apply on each element of the iterable.public <B> B foldRight(F2<A,B,B> f, B z)
f
- The function with which to fold the wrapped iterable.z
- The base case value of the destination type, applied last (rightmost) to the fold.public java.util.Iterator<A> iterator()
iterator
in interface java.lang.Iterable<A>
public <B> IterableW<B> zapp(java.lang.Iterable<F<A,B>> fs)
fs
- The iterable of functions to apply to this iterable.public <B,C> java.lang.Iterable<C> zipWith(java.lang.Iterable<B> bs, F<A,F<B,C>> f)
bs
- The iterable to zip this iterable with.f
- The function to zip this iterable and the given iterable with.public <B,C> java.lang.Iterable<C> zipWith(java.lang.Iterable<B> bs, F2<A,B,C> f)
bs
- The iterable to zip this iterable with.f
- The function to zip this iterable and the given iterable with.public <B> java.lang.Iterable<P2<A,B>> zip(java.lang.Iterable<B> bs)
bs
- The iterable to zip this iterable with.public java.lang.Iterable<P2<A,java.lang.Integer>> zipIndex()
public java.util.List<A> toStandardList()