Class Partition<A,B,C>
- java.lang.Object
-
- com.jnape.palatable.lambda.functions.builtin.fn2.Partition<A,B,C>
-
- Type Parameters:
A
- A type contravariant to the input Iterable element typeB
- The output left Iterable element type, as well as the CoProduct2 A typeC
- The output right Iterable element type, as well as the CoProduct2 B type
- All Implemented Interfaces:
Fn1<Fn1<? super A,? extends CoProduct2<B,C,?>>,Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>>
,Fn2<Fn1<? super A,? extends CoProduct2<B,C,?>>,java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>
,Applicative<Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>,Fn1<Fn1<? super A,? extends CoProduct2<B,C,?>>,?>>
,Cartesian<Fn1<? super A,? extends CoProduct2<B,C,?>>,Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>,Fn1<?,?>>
,Cocartesian<Fn1<? super A,? extends CoProduct2<B,C,?>>,Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>,Fn1<?,?>>
,Contravariant<Fn1<? super A,? extends CoProduct2<B,C,?>>,Profunctor<?,Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>,Fn1<?,?>>>
,Functor<Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>,Fn1<Fn1<? super A,? extends CoProduct2<B,C,?>>,?>>
,Profunctor<Fn1<? super A,? extends CoProduct2<B,C,?>>,Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>,Fn1<?,?>>
,Monad<Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>,Fn1<Fn1<? super A,? extends CoProduct2<B,C,?>>,?>>
,MonadReader<Fn1<? super A,? extends CoProduct2<B,C,?>>,Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>,Fn1<Fn1<? super A,? extends CoProduct2<B,C,?>>,?>>
,MonadRec<Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>,Fn1<Fn1<? super A,? extends CoProduct2<B,C,?>>,?>>
,MonadWriter<Fn1<? super A,? extends CoProduct2<B,C,?>>,Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>,Fn1<Fn1<? super A,? extends CoProduct2<B,C,?>>,?>>
public final class Partition<A,B,C> extends java.lang.Object implements Fn2<Fn1<? super A,? extends CoProduct2<B,C,?>>,java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>
Given anIterable<A>
as
and a disjoint mapping functiona -> CoProduct2<A, B>
, return aTuple2
over the lazily unwrapped leftA
and rightB
values in the first and second slots, respectively. Note that while the tuple must be constructed eagerly, the left and right iterables contained therein are both lazy, so comprehension over infinite iterables is supported.- See Also:
CoProduct2
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Partition()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>
checkedApply(Fn1<? super A,? extends CoProduct2<B,C,?>> function, java.lang.Iterable<A> as)
static <A,B,C>
Partition<A,B,C>partition()
static <A,B,C>
Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>>partition(Fn1<? super A,? extends CoProduct2<B,C,?>> function)
static <A,B,C>
Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>partition(Fn1<? super A,? extends CoProduct2<B,C,?>> function, java.lang.Iterable<A> as)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.jnape.palatable.lambda.functions.Fn1
andThen, carry, cartesian, censor, choose, cocartesian, diMap, diMapR, discardL, flatMap, fmap, lazyZip, listens, local, pure, self, thunk, toFunction, trampolineM, zip, zip
-
-
-
-
Field Detail
-
INSTANCE
private static final Partition<?,?,?> INSTANCE
-
-
Method Detail
-
checkedApply
public Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>> checkedApply(Fn1<? super A,? extends CoProduct2<B,C,?>> function, java.lang.Iterable<A> as)
- Specified by:
checkedApply
in interfaceFn2<A,B,C>
-
partition
public static <A,B,C> Partition<A,B,C> partition()
-
partition
public static <A,B,C> Fn1<java.lang.Iterable<A>,Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>>> partition(Fn1<? super A,? extends CoProduct2<B,C,?>> function)
-
partition
public static <A,B,C> Tuple2<java.lang.Iterable<B>,java.lang.Iterable<C>> partition(Fn1<? super A,? extends CoProduct2<B,C,?>> function, java.lang.Iterable<A> as)
-
-