T
- public class CompletableFutureTSeq<A> extends java.lang.Object implements CompletableFutureT<A>, ValueTransformerSeq<A>, IterableFoldable<A>, ConvertableSequence<A>, CyclopsCollectable<A>, Sequential<A>
Modifier and Type | Method and Description |
---|---|
org.jooq.lambda.Collectable<A> |
collectable()
Narrow this class to a Collectable
|
CompletableFutureTSeq<A> |
combine(java.util.function.BiPredicate<? super A,? super A> predicate,
java.util.function.BinaryOperator<A> op)
Combine two adjacent elements in a traversable using the supplied BinaryOperator
This is a stateful grouping & reduction operation.
|
CompletableFutureTSeq<A> |
cycle(int times)
Convert to a Stream with the values repeated specified times
|
CompletableFutureTSeq<A> |
cycle(Monoid<A> m,
int times)
Convert to a Stream with the result of a reduction operation repeated
specified times
|
CompletableFutureTSeq<A> |
cycleUntil(java.util.function.Predicate<? super A> predicate)
Repeat in a Stream until specified predicate holds
|
CompletableFutureTSeq<A> |
cycleWhile(java.util.function.Predicate<? super A> predicate)
Repeat in a Stream while specified predicate holds
|
CompletableFutureTSeq<A> |
distinct() |
CompletableFutureTSeq<A> |
dropRight(int num) |
CompletableFutureTSeq<A> |
dropUntil(java.util.function.Predicate<? super A> p) |
CompletableFutureTSeq<A> |
dropWhile(java.util.function.Predicate<? super A> p) |
<R> CompletableFutureTSeq<R> |
empty() |
static <T> CompletableFutureTSeq<T> |
emptyList() |
boolean |
equals(java.lang.Object o) |
MaybeTSeq<A> |
filter(java.util.function.Predicate<? super A> test)
Filter the wrapped Maybe
|
<B> CompletableFutureTSeq<B> |
flatMap(java.util.function.Function<? super A,? extends MonadicValue<? extends B>> f) |
<B> CompletableFutureTSeq<B> |
flatMapT(java.util.function.Function<? super A,CompletableFutureTSeq<B>> f)
Flat Map the wrapped CompletableFuture
|
static <A> CompletableFutureTSeq<A> |
fromAnyM(AnyMSeq<A> anyM)
|
<K> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<K,org.jooq.lambda.Seq<A>>> |
grouped(java.util.function.Function<? super A,? extends K> classifier) |
<K,T,D> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<K,D>> |
grouped(java.util.function.Function<? super A,? extends K> classifier,
java.util.stream.Collector<? super A,T,D> downstream) |
CompletableFutureTSeq<ListX<A>> |
grouped(int groupSize)
Group elements in a Stream
|
<C extends java.util.Collection<? super A>> |
grouped(int size,
java.util.function.Supplier<C> supplier)
Batch elements in a Stream by size into a collection created by the
supplied factory
|
CompletableFutureTSeq<ListX<A>> |
groupedStatefullyWhile(java.util.function.BiPredicate<ListX<? super A>,? super A> predicate)
Create Travesable of Lists where
each List is populated while the supplied bipredicate holds.
|
CompletableFutureTSeq<ListX<A>> |
groupedUntil(java.util.function.Predicate<? super A> predicate)
Create a Traversable batched by List, where each batch is populated until
the predicate holds
|
<C extends java.util.Collection<? super A>> |
groupedUntil(java.util.function.Predicate<? super A> predicate,
java.util.function.Supplier<C> factory)
Create a SequenceM batched by a Collection, where each batch is populated
until the predicate holds
|
CompletableFutureTSeq<ListX<A>> |
groupedWhile(java.util.function.Predicate<? super A> predicate)
Create a Traversable batched by List, where each batch is populated while
the predicate holds
|
<C extends java.util.Collection<? super A>> |
groupedWhile(java.util.function.Predicate<? super A> predicate,
java.util.function.Supplier<C> factory)
Create a SequenceM batched by a Collection, where each batch is populated
while the predicate holds
|
int |
hashCode() |
CompletableFutureTSeq<A> |
intersperse(A value)
Returns a stream with a given value interspersed between any two values
of this stream.
|
boolean |
isSeqPresent() |
java.util.Iterator<A> |
iterator() |
static <U,R> java.util.function.Function<CompletableFutureTSeq<U>,CompletableFutureTSeq<R>> |
lift(java.util.function.Function<? super U,? extends R> fn)
Lift a function into one that accepts and returns an CompletableFutureT
This allows multiple monad types to add functionality to existing functions and methods
e.g.
|
static <U1,U2,R> java.util.function.BiFunction<CompletableFutureTSeq<U1>,CompletableFutureTSeq<U2>,CompletableFutureTSeq<R>> |
lift2(java.util.function.BiFunction<? super U1,? super U2,? extends R> fn)
Lift a BiFunction into one that accepts and returns CompletableFutureTs
This allows multiple monad types to add functionality to existing functions and methods
e.g.
|
CompletableFutureTSeq<A> |
limit(long num)
assertThat(ReactiveSeq.of(4,3,6,7).limit(2).toList(),equalTo(Arrays.asList(4,3)); |
CompletableFutureTSeq<A> |
limitLast(int num)
Limit results to the last x elements in a SequenceM
|
CompletableFutureTSeq<A> |
limitUntil(java.util.function.Predicate<? super A> p)
Take elements from the Stream until the predicate returns true, after
which all elements are excluded.
|
CompletableFutureTSeq<A> |
limitWhile(java.util.function.Predicate<? super A> p)
Take elements from the Stream while the predicate holds, once the
predicate returns false all subsequent elements are excluded
|
<B> CompletableFutureTSeq<B> |
map(java.util.function.Function<? super A,? extends B> f)
Map the wrapped CompletableFuture
|
static <A> CompletableFutureTSeq<A> |
of(AnyMSeq<java.util.concurrent.CompletableFuture<A>> monads)
Construct an CompletableFutureT from an AnyM that wraps a monad containing CompletableFutures
|
static <A> CompletableFutureTSeq<A> |
of(java.util.concurrent.CompletableFuture<A> monads) |
CompletableFutureTSeq<A> |
onEmpty(A value) |
CompletableFutureTSeq<A> |
onEmptyGet(java.util.function.Supplier<? extends A> supplier) |
<X extends java.lang.Throwable> |
onEmptyThrow(java.util.function.Supplier<? extends X> supplier) |
CompletableFutureTSeq<A> |
peek(java.util.function.Consumer<? super A> peek)
Peek at the current value of the CompletableFuture
|
CompletableFutureTSeq<A> |
reverse() |
CompletableFutureTSeq<A> |
scanLeft(Monoid<A> monoid)
Scan left using supplied Monoid
|
<U> CompletableFutureTSeq<U> |
scanLeft(U seed,
java.util.function.BiFunction<? super U,? super A,? extends U> function)
Scan left
|
CompletableFutureTSeq<A> |
scanRight(Monoid<A> monoid)
Scan right
|
<U> CompletableFutureTSeq<U> |
scanRight(U identity,
java.util.function.BiFunction<? super A,? super U,? extends U> combiner)
Scan right
|
CompletableFutureTSeq<A> |
shuffle() |
CompletableFutureTSeq<A> |
shuffle(java.util.Random random) |
CompletableFutureTSeq<A> |
skip(long num)
assertThat(ReactiveSeq.of(4,3,6,7).skip(2).toList(),equalTo(Arrays.asList(6,7))); |
CompletableFutureTSeq<A> |
skipLast(int num)
assertThat(ReactiveSeq.of(1,2,3,4,5) .skipLast(2)
.collect(Collectors.toList()),equalTo(Arrays.asList(1,2,3)));
|
CompletableFutureTSeq<A> |
skipUntil(java.util.function.Predicate<? super A> p)
Drop elements from the Stream until the predicate returns true, after
which all elements are included
|
CompletableFutureTSeq<A> |
skipWhile(java.util.function.Predicate<? super A> p)
SkipWhile drops elements from the Stream while the predicate holds, once
the predicte returns true all subsequent elements are included *
|
CompletableFutureTSeq<A> |
slice(long from,
long to) |
CompletableFutureTSeq<ListX<A>> |
sliding(int windowSize)
Create a sliding view over this Sequence
|
CompletableFutureTSeq<ListX<A>> |
sliding(int windowSize,
int increment)
Create a sliding view over this Sequence
|
CompletableFutureTSeq<A> |
sorted()
assertThat(ReactiveSeq.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7))); |
CompletableFutureTSeq<A> |
sorted(java.util.Comparator<? super A> c)
assertThat(ReactiveSeq.of(4,3,6,7).sorted((a,b) -> b-a).toList(),equalTo(Arrays.asList(7,6,4,3)));
|
<U extends java.lang.Comparable<? super U>> |
sorted(java.util.function.Function<? super A,? extends U> function) |
ReactiveSeq<A> |
stream() |
CompletableFutureTSeq<A> |
takeRight(int num) |
CompletableFutureTSeq<A> |
takeUntil(java.util.function.Predicate<? super A> p) |
CompletableFutureTSeq<A> |
takeWhile(java.util.function.Predicate<? super A> p) |
java.lang.String |
toString() |
AnyMSeq<? extends Traversable<A>> |
transformerStream() |
<R> CompletableFutureTSeq<R> |
unit(R value) |
<T> CompletableFutureTSeq<T> |
unitAnyM(AnyM<Traversable<T>> traversable) |
<R> CompletableFutureTSeq<R> |
unitIterator(java.util.Iterator<R> it) |
<T> CompletableFutureTSeq<T> |
unitStream(ReactiveSeq<T> traversable) |
AnyMSeq<java.util.concurrent.CompletableFuture<A>> |
unwrap() |
<U> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<A,U>> |
zip(java.lang.Iterable<? extends U> other) |
<U,R> CompletableFutureTSeq<R> |
zip(java.lang.Iterable<? extends U> other,
java.util.function.BiFunction<? super A,? super U,? extends R> zipper) |
<U> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<A,U>> |
zip(org.jooq.lambda.Seq<? extends U> other) |
<U,R> CompletableFutureTSeq<R> |
zip(org.jooq.lambda.Seq<? extends U> other,
java.util.function.BiFunction<? super A,? super U,? extends R> zipper) |
<U> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<A,U>> |
zip(java.util.stream.Stream<? extends U> other)
Zip 2 streams into one
|
<U,R> CompletableFutureTSeq<R> |
zip(java.util.stream.Stream<? extends U> other,
java.util.function.BiFunction<? super A,? super U,? extends R> zipper) |
<S,U> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple3<A,S,U>> |
zip3(java.util.stream.Stream<? extends S> second,
java.util.stream.Stream<? extends U> third)
zip 3 Streams into one
|
<T2,T3,T4> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple4<A,T2,T3,T4>> |
zip4(java.util.stream.Stream<? extends T2> second,
java.util.stream.Stream<? extends T3> third,
java.util.stream.Stream<? extends T4> fourth)
zip 4 Streams into 1
|
CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<A,java.lang.Long>> |
zipWithIndex()
Add an index to the current Stream
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
bind, cast, emptyMaybe, filterNot, fromAnyM, fromAnyMSeq, fromAnyMValue, fromFuture, fromIterable, fromIterableValue, fromOptional, fromPublisher, fromStream, fromValue, notNull, of, ofType, patternMatch, trampoline
subscribe
futureOperations, lazyOperations
seq, toCompletableFuture, toDequeX, toEvalAlways, toEvalLater, toEvalNow, toFutureStream, toFutureStream, toFutureW, toIor, toIorSecondary, toListX, toMapX, toMaybe, toOptional, toPBagX, toPMapX, toPOrderedSetX, toPQueueX, toPSetX, toPStackX, toPVectorX, toQueueX, toSetX, toSimpleReact, toSimpleReact, toSortedSetX, toStreamable, toTry, toValue, toValueMap, toValueSet, toXor, toXorSecondary
traversable
fixedDelay, onePer, xPer
futureStream, getStreamable, isEmpty, jdkStream, reactiveSeq, reveresedJDKStream, reveresedStream
foldable, headAndTail, visit
endsWith, endsWithIterable, findAny, findFirst, firstValue, foldRight, foldRight, foldRight, foldRightMapToType, get, groupBy, join, join, join, mapReduce, mapReduce, print, print, printErr, printOut, reduce, reduce, reduce, reduce, reduce, reduce, reduce, schedule, scheduleFixedDelay, scheduleFixedRate, single, single, singleOptional, startsWith, startsWithIterable, toConcurrentLazyCollection, toConcurrentLazyStreamable, toLazyCollection, validate, xMatch
allMatch, anyMatch, avg, avg, avgDouble, avgInt, avgLong, bitAnd, bitAnd, bitAndInt, bitAndLong, bitOr, bitOr, bitOrInt, bitOrLong, collect, commonPrefix, commonSuffix, count, count, countDistinct, countDistinct, countDistinctBy, countDistinctBy, max, max, max, max, maxAll, maxAll, maxAll, maxAll, maxAllBy, maxAllBy, maxBy, maxBy, median, median, medianBy, medianBy, min, min, min, min, minAll, minAll, minAll, minAll, minAllBy, minAllBy, minBy, minBy, mode, modeAll, modeAllBy, modeBy, noneMatch, percentile, percentile, percentileBy, percentileBy, sum, sum, sumDouble, sumInt, sumLong, toCollection, toList, toList, toMap, toMap, toSet, toSet, toString, toString
public AnyMSeq<java.util.concurrent.CompletableFuture<A>> unwrap()
unwrap
in interface CompletableFutureT<A>
public MaybeTSeq<A> filter(java.util.function.Predicate<? super A> test)
MaybeT.of(AnyM.fromStream(Maybe.of(10))
.filter(t->t!=10);
//MaybeT<AnyMSeq<Stream<Maybe.empty>>>
filter
in interface CompletableFutureT<A>
filter
in interface Filterable<A>
test
- Predicate to filter the wrapped Maybepublic CompletableFutureTSeq<A> peek(java.util.function.Consumer<? super A> peek)
CompletableFutureT.of(AnyM.fromStream(Arrays.asCompletableFuture(10))
.peek(System.out::println);
//prints 10
public <B> CompletableFutureTSeq<B> map(java.util.function.Function<? super A,? extends B> f)
CompletableFutureT.of(AnyM.fromStream(Arrays.asCompletableFuture(10))
.map(t->t=t+1);
//CompletableFutureT<AnyMSeq<Stream<CompletableFuture[11]>>>
public <B> CompletableFutureTSeq<B> flatMapT(java.util.function.Function<? super A,CompletableFutureTSeq<B>> f)
CompletableFutureT.of(AnyM.fromStream(Arrays.asCompletableFuture(10))
.flatMap(t->CompletableFuture.completedFuture(20));
//CompletableFutureT<AnyMSeq<Stream<CompletableFuture[20]>>>
f
- FlatMap functionpublic <B> CompletableFutureTSeq<B> flatMap(java.util.function.Function<? super A,? extends MonadicValue<? extends B>> f)
flatMap
in interface CompletableFutureT<A>
public static <U,R> java.util.function.Function<CompletableFutureTSeq<U>,CompletableFutureTSeq<R>> lift(java.util.function.Function<? super U,? extends R> fn)
Function<Integer,Integer> add2 = i -> i+2;
Function<CompletableFutureT<Integer>, CompletableFutureT<Integer>> optTAdd2 = CompletableFutureT.lift(add2);
Stream<Integer> withNulls = Stream.of(1,2,3);
AnyMSeq<Integer> stream = AnyM.fromStream(withNulls);
AnyMSeq<CompletableFuture<Integer>> streamOpt = stream.map(CompletableFuture::completedFuture);
List<Integer> results = optTAdd2.apply(CompletableFutureT.of(streamOpt))
.unwrap()
.<Stream<CompletableFuture<Integer>>>unwrap()
.map(CompletableFuture::join)
.collect(Collectors.toList());
//CompletableFuture.completedFuture(List[3,4]);
lift
in interface CompletableFutureT<A>
fn
- Function to enhance with functionality from CompletableFuture and another monad typepublic static <U1,U2,R> java.util.function.BiFunction<CompletableFutureTSeq<U1>,CompletableFutureTSeq<U2>,CompletableFutureTSeq<R>> lift2(java.util.function.BiFunction<? super U1,? super U2,? extends R> fn)
BiFunction<Integer,Integer,Integer> add = (a,b) -> a+b;
BiFunction<CompletableFutureT<Integer>,CompletableFutureT<Integer>,CompletableFutureT<Integer>> optTAdd2 = CompletableFutureT.lift2(add);
Stream<Integer> withNulls = Stream.of(1,2,3);
AnyMSeq<Integer> stream = AnyM.ofMonad(withNulls);
AnyMSeq<CompletableFuture<Integer>> streamOpt = stream.map(CompletableFuture::completedFuture);
CompletableFuture<CompletableFuture<Integer>> two = CompletableFuture.completedFuture(CompletableFuture.completedFuture(2));
AnyMSeq<CompletableFuture<Integer>> future= AnyM.fromCompletableFuture(two);
List<Integer> results = optTAdd2.apply(CompletableFutureT.of(streamOpt),CompletableFutureT.of(future))
.unwrap()
.<Stream<CompletableFuture<Integer>>>unwrap()
.map(CompletableFuture::join)
.collect(Collectors.toList());
//CompletableFuture.completedFuture(List[3,4,5]);
lift2
in interface CompletableFutureT<A>
fn
- BiFunction to enhance with functionality from CompletableFuture and another monad typepublic static <A> CompletableFutureTSeq<A> fromAnyM(AnyMSeq<A> anyM)
anyM
- AnyM that doesn't contain a monad wrapping an CompletableFuturepublic static <A> CompletableFutureTSeq<A> of(AnyMSeq<java.util.concurrent.CompletableFuture<A>> monads)
monads
- AnyM that contains a monad wrapping an CompletableFuturepublic static <A> CompletableFutureTSeq<A> of(java.util.concurrent.CompletableFuture<A> monads)
public java.lang.String toString()
toString
in class java.lang.Object
public ReactiveSeq<A> stream()
stream
in interface TransformerSeq<A>
stream
in interface Foldable<A>
stream
in interface Sequential<A>
stream
in interface ConvertableSequence<A>
stream
in interface ToStream<A>
stream
in interface Traversable<A>
public java.util.Iterator<A> iterator()
public <T> CompletableFutureTSeq<T> unitStream(ReactiveSeq<T> traversable)
unitStream
in interface ValueTransformerSeq<A>
public <T> CompletableFutureTSeq<T> unitAnyM(AnyM<Traversable<T>> traversable)
unitAnyM
in interface TransformerSeq<A>
public AnyMSeq<? extends Traversable<A>> transformerStream()
transformerStream
in interface TransformerSeq<A>
public <R> CompletableFutureTSeq<R> unitIterator(java.util.Iterator<R> it)
public <R> CompletableFutureTSeq<R> unit(R value)
public <R> CompletableFutureTSeq<R> empty()
empty
in interface CompletableFutureT<A>
public org.jooq.lambda.Collectable<A> collectable()
CyclopsCollectable
collectable
in interface CyclopsCollectable<A>
public boolean isSeqPresent()
isSeqPresent
in interface TransformerSeq<A>
public static <T> CompletableFutureTSeq<T> emptyList()
emptyList
in interface CompletableFutureT<A>
public CompletableFutureTSeq<A> combine(java.util.function.BiPredicate<? super A,? super A> predicate, java.util.function.BinaryOperator<A> op)
Traversable
ReactiveSeq.of(1,1,2,3)
.combine((a, b)->a.equals(b),Semigroups.intSum)
.toListX()
//ListX(3,4)
combine
in interface TransformerSeq<A>
combine
in interface ValueTransformerSeq<A>
combine
in interface Traversable<A>
predicate
- Test to see if two neighbours should be joinedop
- Reducer to combine neighbourspublic CompletableFutureTSeq<A> cycle(int times)
Traversable
ReactiveSeq.of(1,2,2)
.cycle(3)
.collect(Collectors.toList());
//List[1,2,2,1,2,2,1,2,2]
cycle
in interface TransformerSeq<A>
cycle
in interface ValueTransformerSeq<A>
cycle
in interface Traversable<A>
times
- Times values should be repeated within a Streampublic CompletableFutureTSeq<A> cycle(Monoid<A> m, int times)
Traversable
List<Integer> list = ReactiveSeq.of(1,2,2))
.cycle(Reducers.toCountInt(),3)
.collect(Collectors.toList());
//List[3,3,3];
cycle
in interface TransformerSeq<A>
cycle
in interface ValueTransformerSeq<A>
cycle
in interface Traversable<A>
m
- Monoid to be used in reductiontimes
- Number of times value should be repeatedpublic CompletableFutureTSeq<A> cycleWhile(java.util.function.Predicate<? super A> predicate)
Traversable
{ @code MutableInt count = MutableInt.of(0); ReactiveSeq.of(1, 2, 2).cycleWhile(next -> count++ < 6).collect(Collectors.toList()); // List(1,2,2,1,2,2) }
cycleWhile
in interface TransformerSeq<A>
cycleWhile
in interface ValueTransformerSeq<A>
cycleWhile
in interface Traversable<A>
predicate
- repeat while truepublic CompletableFutureTSeq<A> cycleUntil(java.util.function.Predicate<? super A> predicate)
Traversable
MutableInt count =MutableInt.of(0);
ReactiveSeq.of(1,2,2)
.cycleUntil(next -> count.get()>6)
.peek(i-> count.mutate(i->i+1))
.collect(Collectors.toList());
//List[1,2,2,1,2,2,1]
cycleUntil
in interface TransformerSeq<A>
cycleUntil
in interface ValueTransformerSeq<A>
cycleUntil
in interface Traversable<A>
predicate
- repeat while truepublic <U,R> CompletableFutureTSeq<R> zip(java.lang.Iterable<? extends U> other, java.util.function.BiFunction<? super A,? super U,? extends R> zipper)
zip
in interface TransformerSeq<A>
zip
in interface ValueTransformerSeq<A>
zip
in interface Traversable<A>
public <U,R> CompletableFutureTSeq<R> zip(org.jooq.lambda.Seq<? extends U> other, java.util.function.BiFunction<? super A,? super U,? extends R> zipper)
zip
in interface TransformerSeq<A>
zip
in interface ValueTransformerSeq<A>
zip
in interface Traversable<A>
public <U,R> CompletableFutureTSeq<R> zip(java.util.stream.Stream<? extends U> other, java.util.function.BiFunction<? super A,? super U,? extends R> zipper)
zip
in interface TransformerSeq<A>
zip
in interface ValueTransformerSeq<A>
zip
in interface Traversable<A>
public <U> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<A,U>> zip(java.util.stream.Stream<? extends U> other)
Traversable
{ @code List<Tuple2<Integer, String>> list = of(1, 2).zip(of("a", "b", "c", "d")).toList(); // [[1,"a"],[2,"b"]] }
zip
in interface TransformerSeq<A>
zip
in interface ValueTransformerSeq<A>
zip
in interface Traversable<A>
public <U> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<A,U>> zip(java.lang.Iterable<? extends U> other)
zip
in interface TransformerSeq<A>
zip
in interface ValueTransformerSeq<A>
zip
in interface Traversable<A>
public <U> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<A,U>> zip(org.jooq.lambda.Seq<? extends U> other)
zip
in interface TransformerSeq<A>
zip
in interface ValueTransformerSeq<A>
zip
in interface Traversable<A>
public <S,U> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple3<A,S,U>> zip3(java.util.stream.Stream<? extends S> second, java.util.stream.Stream<? extends U> third)
Traversable
{ @code List<Tuple3<Integer, Integer, Character>> list = of(1, 2, 3, 4, 5, 6).zip3(of(100, 200, 300, 400), of('a', 'b', 'c')).collect(Collectors.toList()); // [[1,100,'a'],[2,200,'b'],[3,300,'c']] }
zip3
in interface TransformerSeq<A>
zip3
in interface ValueTransformerSeq<A>
zip3
in interface Traversable<A>
public <T2,T3,T4> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple4<A,T2,T3,T4>> zip4(java.util.stream.Stream<? extends T2> second, java.util.stream.Stream<? extends T3> third, java.util.stream.Stream<? extends T4> fourth)
Traversable
{ @code List<Tuple4<Integer, Integer, Character, String>> list = of(1, 2, 3, 4, 5, 6).zip4(of(100, 200, 300, 400), of('a', 'b', 'c'), of("hello", "world")) .collect(Collectors.toList()); } // [[1,100,'a',"hello"],[2,200,'b',"world"]]
zip4
in interface TransformerSeq<A>
zip4
in interface ValueTransformerSeq<A>
zip4
in interface Traversable<A>
public CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<A,java.lang.Long>> zipWithIndex()
Traversable
assertEquals(asList(new Tuple2("a", 0L), new Tuple2("b", 1L)), of("a", "b").zipWithIndex().toList());
zipWithIndex
in interface TransformerSeq<A>
zipWithIndex
in interface ValueTransformerSeq<A>
zipWithIndex
in interface Traversable<A>
public CompletableFutureTSeq<ListX<A>> sliding(int windowSize)
Traversable
{ @code List<List<Integer>> list = ReactiveSeq.of(1, 2, 3, 4, 5, 6).sliding(2).collect(Collectors.toList()); assertThat(list.get(0), hasItems(1, 2)); assertThat(list.get(1), hasItems(2, 3)); }
sliding
in interface TransformerSeq<A>
sliding
in interface ValueTransformerSeq<A>
sliding
in interface Traversable<A>
windowSize
- Size of sliding windowpublic CompletableFutureTSeq<ListX<A>> sliding(int windowSize, int increment)
Traversable
{ @code List<List<Integer>> list = ReactiveSeq.of(1, 2, 3, 4, 5, 6).sliding(3, 2).collect(Collectors.toList()); assertThat(list.get(0), hasItems(1, 2, 3)); assertThat(list.get(1), hasItems(3, 4, 5)); }
sliding
in interface TransformerSeq<A>
sliding
in interface ValueTransformerSeq<A>
sliding
in interface Traversable<A>
windowSize
- number of elements in each batchincrement
- for each windowpublic <C extends java.util.Collection<? super A>> CompletableFutureTSeq<C> grouped(int size, java.util.function.Supplier<C> supplier)
Traversable
assertThat(ReactiveSeq.of(1,1,1,1,1,1)
.batchBySize(3,()->new TreeSet<>())
.toList()
.get(0)
.size(),is(1));
grouped
in interface TransformerSeq<A>
grouped
in interface ValueTransformerSeq<A>
grouped
in interface Traversable<A>
size
- batch sizesupplier
- Collection factorypublic CompletableFutureTSeq<ListX<A>> groupedUntil(java.util.function.Predicate<? super A> predicate)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedUntil(i->i%3==0)
.toList()
.size(),equalTo(2));
groupedUntil
in interface TransformerSeq<A>
groupedUntil
in interface ValueTransformerSeq<A>
groupedUntil
in interface Traversable<A>
predicate
- Batch until predicate holds, then open next batchpublic CompletableFutureTSeq<ListX<A>> groupedStatefullyWhile(java.util.function.BiPredicate<ListX<? super A>,? super A> predicate)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedStatefullyWhile((s,i)->s.contains(4) ? true : false)
.toList().size(),equalTo(5));
groupedStatefullyWhile
in interface TransformerSeq<A>
groupedStatefullyWhile
in interface ValueTransformerSeq<A>
groupedStatefullyWhile
in interface Traversable<A>
predicate
- Window while truepublic CompletableFutureTSeq<ListX<A>> groupedWhile(java.util.function.Predicate<? super A> predicate)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedWhile(i->i%3!=0)
.toList().size(),equalTo(2));
groupedWhile
in interface TransformerSeq<A>
groupedWhile
in interface ValueTransformerSeq<A>
groupedWhile
in interface Traversable<A>
predicate
- Batch while predicate holds, then open next batchpublic <C extends java.util.Collection<? super A>> CompletableFutureTSeq<C> groupedWhile(java.util.function.Predicate<? super A> predicate, java.util.function.Supplier<C> factory)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.batchWhile(i->i%3!=0)
.toList()
.size(),equalTo(2));
groupedWhile
in interface TransformerSeq<A>
groupedWhile
in interface ValueTransformerSeq<A>
groupedWhile
in interface Traversable<A>
predicate
- Batch while predicate holds, then open next batchfactory
- Collection factorypublic <C extends java.util.Collection<? super A>> CompletableFutureTSeq<C> groupedUntil(java.util.function.Predicate<? super A> predicate, java.util.function.Supplier<C> factory)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.batchUntil(i->i%3!=0)
.toList()
.size(),equalTo(2));
groupedUntil
in interface TransformerSeq<A>
groupedUntil
in interface ValueTransformerSeq<A>
groupedUntil
in interface Traversable<A>
predicate
- Batch until predicate holds, then open next batchfactory
- Collection factorypublic CompletableFutureTSeq<ListX<A>> grouped(int groupSize)
Traversable
{ @code List<List<Integer>> list = ReactiveSeq.of(1, 2, 3, 4, 5, 6).grouped(3).collect(Collectors.toList()); assertThat(list.get(0), hasItems(1, 2, 3)); assertThat(list.get(1), hasItems(4, 5, 6)); }
grouped
in interface TransformerSeq<A>
grouped
in interface ValueTransformerSeq<A>
grouped
in interface Traversable<A>
groupSize
- Size of each Grouppublic <K,T,D> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<K,D>> grouped(java.util.function.Function<? super A,? extends K> classifier, java.util.stream.Collector<? super A,T,D> downstream)
grouped
in interface TransformerSeq<A>
grouped
in interface ValueTransformerSeq<A>
grouped
in interface Traversable<A>
public <K> CompletableFutureTSeq<org.jooq.lambda.tuple.Tuple2<K,org.jooq.lambda.Seq<A>>> grouped(java.util.function.Function<? super A,? extends K> classifier)
grouped
in interface TransformerSeq<A>
grouped
in interface ValueTransformerSeq<A>
grouped
in interface Traversable<A>
public CompletableFutureTSeq<A> distinct()
distinct
in interface TransformerSeq<A>
distinct
in interface ValueTransformerSeq<A>
distinct
in interface Traversable<A>
public CompletableFutureTSeq<A> scanLeft(Monoid<A> monoid)
Traversable
assertEquals(asList("", "a", "ab", "abc"),ReactiveSeq.of("a", "b", "c")
.scanLeft(Reducers.toString("")).toList());
scanLeft
in interface TransformerSeq<A>
scanLeft
in interface ValueTransformerSeq<A>
scanLeft
in interface Traversable<A>
public <U> CompletableFutureTSeq<U> scanLeft(U seed, java.util.function.BiFunction<? super U,? super A,? extends U> function)
Traversable
assertThat(of("a", "b", "c").scanLeft("", String::concat).toList().size(),
is(4));
scanLeft
in interface TransformerSeq<A>
scanLeft
in interface ValueTransformerSeq<A>
scanLeft
in interface Traversable<A>
public CompletableFutureTSeq<A> scanRight(Monoid<A> monoid)
Traversable
assertThat(of("a", "b", "c").scanRight(Monoid.of("", String::concat)).toList().size(),
is(asList("", "c", "bc", "abc").size()));
scanRight
in interface TransformerSeq<A>
scanRight
in interface ValueTransformerSeq<A>
scanRight
in interface Traversable<A>
public <U> CompletableFutureTSeq<U> scanRight(U identity, java.util.function.BiFunction<? super A,? super U,? extends U> combiner)
Traversable
assertThat(of("a", "ab", "abc").map(str->str.length()).scanRight(0, (t, u) -> u + t).toList().size(),
is(asList(0, 3, 5, 6).size()));
scanRight
in interface TransformerSeq<A>
scanRight
in interface ValueTransformerSeq<A>
scanRight
in interface Traversable<A>
public CompletableFutureTSeq<A> sorted()
Traversable
assertThat(ReactiveSeq.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7)));
sorted
in interface TransformerSeq<A>
sorted
in interface ValueTransformerSeq<A>
sorted
in interface Traversable<A>
public CompletableFutureTSeq<A> sorted(java.util.Comparator<? super A> c)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).sorted((a,b) -> b-a).toList(),equalTo(Arrays.asList(7,6,4,3)));
sorted
in interface TransformerSeq<A>
sorted
in interface ValueTransformerSeq<A>
sorted
in interface Traversable<A>
c
- Compartor to sort withpublic CompletableFutureTSeq<A> takeWhile(java.util.function.Predicate<? super A> p)
takeWhile
in interface TransformerSeq<A>
takeWhile
in interface ValueTransformerSeq<A>
takeWhile
in interface Traversable<A>
public CompletableFutureTSeq<A> dropWhile(java.util.function.Predicate<? super A> p)
dropWhile
in interface TransformerSeq<A>
dropWhile
in interface ValueTransformerSeq<A>
dropWhile
in interface Traversable<A>
public CompletableFutureTSeq<A> takeUntil(java.util.function.Predicate<? super A> p)
takeUntil
in interface TransformerSeq<A>
takeUntil
in interface ValueTransformerSeq<A>
takeUntil
in interface Traversable<A>
public CompletableFutureTSeq<A> dropUntil(java.util.function.Predicate<? super A> p)
dropUntil
in interface TransformerSeq<A>
dropUntil
in interface ValueTransformerSeq<A>
dropUntil
in interface Traversable<A>
public CompletableFutureTSeq<A> dropRight(int num)
dropRight
in interface TransformerSeq<A>
dropRight
in interface ValueTransformerSeq<A>
dropRight
in interface Traversable<A>
public CompletableFutureTSeq<A> takeRight(int num)
takeRight
in interface TransformerSeq<A>
takeRight
in interface ValueTransformerSeq<A>
takeRight
in interface Traversable<A>
public CompletableFutureTSeq<A> skip(long num)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).skip(2).toList(),equalTo(Arrays.asList(6,7)));
skip
in interface TransformerSeq<A>
skip
in interface ValueTransformerSeq<A>
skip
in interface Traversable<A>
num
- Number of elemenets to skippublic CompletableFutureTSeq<A> skipWhile(java.util.function.Predicate<? super A> p)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).sorted().skipWhile(i->i<6).toList(),equalTo(Arrays.asList(6,7)));
skipWhile
in interface TransformerSeq<A>
skipWhile
in interface ValueTransformerSeq<A>
skipWhile
in interface Traversable<A>
p
- Predicate to skip while truepublic CompletableFutureTSeq<A> skipUntil(java.util.function.Predicate<? super A> p)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).skipUntil(i->i==6).toList(),equalTo(Arrays.asList(6,7)));
skipUntil
in interface TransformerSeq<A>
skipUntil
in interface ValueTransformerSeq<A>
skipUntil
in interface Traversable<A>
p
- Predicate to skip until truepublic CompletableFutureTSeq<A> limit(long num)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).limit(2).toList(),equalTo(Arrays.asList(4,3));
limit
in interface TransformerSeq<A>
limit
in interface ValueTransformerSeq<A>
limit
in interface Traversable<A>
num
- Limit element size to numpublic CompletableFutureTSeq<A> limitWhile(java.util.function.Predicate<? super A> p)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).sorted().limitWhile(i->i<6).toList(),equalTo(Arrays.asList(3,4)));
limitWhile
in interface TransformerSeq<A>
limitWhile
in interface ValueTransformerSeq<A>
limitWhile
in interface Traversable<A>
p
- Limit while predicate is truepublic CompletableFutureTSeq<A> limitUntil(java.util.function.Predicate<? super A> p)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).limitUntil(i->i==6).toList(),equalTo(Arrays.asList(4,3)));
limitUntil
in interface TransformerSeq<A>
limitUntil
in interface ValueTransformerSeq<A>
limitUntil
in interface Traversable<A>
p
- Limit until predicate is truepublic CompletableFutureTSeq<A> intersperse(A value)
Traversable
intersperse
in interface TransformerSeq<A>
intersperse
in interface ValueTransformerSeq<A>
intersperse
in interface Traversable<A>
public CompletableFutureTSeq<A> reverse()
reverse
in interface TransformerSeq<A>
reverse
in interface ValueTransformerSeq<A>
reverse
in interface Traversable<A>
public CompletableFutureTSeq<A> shuffle()
shuffle
in interface TransformerSeq<A>
shuffle
in interface ValueTransformerSeq<A>
shuffle
in interface Traversable<A>
public CompletableFutureTSeq<A> skipLast(int num)
Traversable
skipLast
in interface TransformerSeq<A>
skipLast
in interface ValueTransformerSeq<A>
skipLast
in interface Traversable<A>
public CompletableFutureTSeq<A> limitLast(int num)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5)
.limitLast(2)
.collect(Collectors.toList()),equalTo(Arrays.asList(4,5)));
limitLast
in interface TransformerSeq<A>
limitLast
in interface ValueTransformerSeq<A>
limitLast
in interface Traversable<A>
num
- of elements to return (last elements)public CompletableFutureTSeq<A> onEmpty(A value)
onEmpty
in interface TransformerSeq<A>
onEmpty
in interface ValueTransformerSeq<A>
onEmpty
in interface Traversable<A>
public CompletableFutureTSeq<A> onEmptyGet(java.util.function.Supplier<? extends A> supplier)
onEmptyGet
in interface TransformerSeq<A>
onEmptyGet
in interface ValueTransformerSeq<A>
onEmptyGet
in interface Traversable<A>
public <X extends java.lang.Throwable> CompletableFutureTSeq<A> onEmptyThrow(java.util.function.Supplier<? extends X> supplier)
onEmptyThrow
in interface TransformerSeq<A>
onEmptyThrow
in interface ValueTransformerSeq<A>
onEmptyThrow
in interface Traversable<A>
public CompletableFutureTSeq<A> shuffle(java.util.Random random)
shuffle
in interface TransformerSeq<A>
shuffle
in interface ValueTransformerSeq<A>
shuffle
in interface Traversable<A>
public CompletableFutureTSeq<A> slice(long from, long to)
slice
in interface TransformerSeq<A>
slice
in interface ValueTransformerSeq<A>
slice
in interface Traversable<A>
public <U extends java.lang.Comparable<? super U>> CompletableFutureTSeq<A> sorted(java.util.function.Function<? super A,? extends U> function)
sorted
in interface TransformerSeq<A>
sorted
in interface ValueTransformerSeq<A>
sorted
in interface Traversable<A>
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object