public class FluxReactiveSeq<T> extends java.lang.Object implements ReactiveSeq<T>
ReactiveSeq.Instances| Constructor and Description |
|---|
FluxReactiveSeq() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allMatch(java.util.function.Predicate<? super T> c)
True if predicate matches all elements when Monad converted to a Stream
|
AnyMSeq<Witness.reactiveSeq,T> |
anyM() |
boolean |
anyMatch(java.util.function.Predicate<? super T> c)
True if a singleUnsafe element matches when Monad converted to a Stream
|
ReactiveSeq<T> |
append(java.lang.Iterable<? extends T> other) |
ReactiveSeq<T> |
append(T... values)
Append values to the take of this ReactiveSeq
|
ReactiveSeq<T> |
append(T value) |
ReactiveSeq<T> |
appendS(java.util.stream.Stream<? extends T> other)
Append Stream to this ReactiveSeq
|
ReactiveSeq<T> |
changes() |
void |
close() |
<R> ReactiveSeq<R> |
coflatMap(java.util.function.Function<? super ReactiveSeq<T>,? extends R> fn)
coflatMap pattern, can be used to perform maybe reductions / collections / folds and other terminal operations
|
<R,A> R |
collect(java.util.stream.Collector<? super T,A,R> collector)
Performs a mutable
reduction operation on the elements of this reactiveStream using a
Collector. |
<R> R |
collect(java.util.function.Supplier<R> supplier,
java.util.function.BiConsumer<R,? super T> accumulator,
java.util.function.BiConsumer<R,R> combiner)
Performs a mutable
reduction operation on the elements of this reactiveStream.
|
<R,A> ReactiveSeq<R> |
collectStream(java.util.stream.Collector<? super T,A,R> collector) |
ReactiveSeq<T> |
complete(java.lang.Runnable fn)
Provide a simpler method to handle stream or async operations.
|
long |
count()
Returns the count of elements in this reactiveStream.
|
ReactiveSeq<T> |
cycle()
Convert to a Stream with the values infinitely cycled
|
ReactiveSeq<T> |
cycle(long times)
Convert to a Stream with the values repeated specified times
|
ReactiveSeq<T> |
debounce(long time,
java.util.concurrent.TimeUnit t)
Allow one element through per time period, drop all other elements in
that time period
|
ReactiveSeq<T> |
distinct() |
<U> ReactiveSeq<T> |
distinct(java.util.function.Function<? super T,? extends U> keyExtractor) |
org.jooq.lambda.tuple.Tuple2<ReactiveSeq<T>,ReactiveSeq<T>> |
duplicate()
Duplicate a Stream, buffers intermediate values, leaders may change
positions so a limit can be safely applied to the leading reactiveStream.
|
org.jooq.lambda.tuple.Tuple2<ReactiveSeq<T>,ReactiveSeq<T>> |
duplicate(java.util.function.Supplier<java.util.Deque<T>> bufferFactory) |
boolean |
endsWith(java.util.stream.Stream<T> stream)
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Stream.of(5,6)));
|
boolean |
endsWithIterable(java.lang.Iterable<T> iterable)
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Arrays.asList(5,6)));
|
ReactiveSeq<T> |
filter(java.util.function.Predicate<? super T> fn)
Keep only elements for which the supplied predicates hold
e.g.
|
java.util.Optional<T> |
findAny() |
java.util.Optional<T> |
findFirst() |
Either<java.lang.Throwable,T> |
findFirstOrError()
Lazy / reactiveBuffer look up of first value , capturing the first error, if one occurs.
|
Maybe<T> |
findOne()
Lazy / reactiveBuffer analogue of findFirst / findAny from JDK
For push based reactiveBuffer-streams (created via Spouts.XXX) data will be pushed to the returned Maybe on arrival.
|
T |
firstValue()
assertThat(ReactiveSeq.of(1,2,3,4)
.map(u->{throw new RuntimeException();})
.recover(e->"hello")
.firstValue(),equalTo("hello"));
|
ReactiveSeq<T> |
fixedDelay(long l,
java.util.concurrent.TimeUnit unit)
emit elements after a fixed delay
|
<R> ReactiveSeq<R> |
flatMap(java.util.function.Function<? super T,? extends java.util.stream.Stream<? extends R>> fn)
flatMap operation
|
<R> ReactiveSeq<R> |
flatMapAnyM(java.util.function.Function<? super T,AnyM<Witness.stream,? extends R>> fn)
Allows flatMap return type to be any Monad type
|
<R> ReactiveSeq<R> |
flatMapI(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> fn)
FlatMap where the result is a Collection, flattens the resultant
collections into the host ReactiveSeq
|
<R> ReactiveSeq<R> |
flatMapP(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn) |
<R> ReactiveSeq<R> |
flatMapP(int maxConcurrency,
java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn) |
<R> ReactiveSeq<R> |
flatMapStream(java.util.function.Function<? super T,java.util.stream.BaseStream<? extends R,?>> fn)
flatMap operation
|
java.util.stream.DoubleStream |
flatMapToDouble(java.util.function.Function<? super T,? extends java.util.stream.DoubleStream> mapper) |
java.util.stream.IntStream |
flatMapToInt(java.util.function.Function<? super T,? extends java.util.stream.IntStream> mapper) |
java.util.stream.LongStream |
flatMapToLong(java.util.function.Function<? super T,? extends java.util.stream.LongStream> mapper) |
<R> FluxReactiveSeq<R> |
flux(reactor.core.publisher.Flux<R> flux) |
<R> FluxReactiveSeq<R> |
flux(ReactiveSeq<R> flux) |
T |
foldRight(Monoid<T> reducer)
ReactiveSeq.of("a","b","c").foldRight(Reducers.toString(""));
// "cab"
|
T |
foldRight(T identity,
java.util.function.BinaryOperator<T> accumulator)
Immutable reduction from right to left
|
<U> U |
foldRight(U identity,
java.util.function.BiFunction<? super T,? super U,? extends U> accumulator)
Immutable reduction from right to left
|
<T1> T1 |
foldRightMapToType(Reducer<T1> reducer)
Attempt to map this Monad to the same type as the supplied Monoid (using
mapToType on the monoid interface) Then use Monoid to reduce values
|
void |
forEach(java.util.function.Consumer<? super T> action)
Performs an action for each element of this Stream.
|
void |
forEachAsync(java.util.function.Consumer<? super T> action)
A potentially non-blocking analog of
ReactiveSeq.forEach(java.util.function.Consumer<? super T>). |
void |
forEachOrdered(java.util.function.Consumer<? super T> action) |
<X extends java.lang.Throwable> |
forEachSubscribe(java.util.function.Consumer<? super T> consumer)
Perform a forEach operation over the Stream, without closing it, consuming only the specified number of elements from
the Stream, at this time.
|
<X extends java.lang.Throwable> |
forEachSubscribe(java.util.function.Consumer<? super T> consumer,
java.util.function.Consumer<? super java.lang.Throwable> consumerError)
Perform a forEach operation over the Stream without closing it, capturing any elements and errors in the supplied consumers, but only consuming
the specified number of elements from the Stream, at this time.
|
<X extends java.lang.Throwable> |
forEachSubscribe(java.util.function.Consumer<? super T> consumer,
java.util.function.Consumer<? super java.lang.Throwable> consumerError,
java.lang.Runnable onComplete)
Perform a forEach operation over the Stream without closing it, capturing any elements and errors in the supplied consumers, but only consuming
the specified number of elements from the Stream, at this time.
|
java.lang.String |
format() |
ReactiveSeq<ListX<T>> |
grouped(int groupSize)
Group elements in a Stream
|
<C extends java.util.Collection<? super T>> |
grouped(int size,
java.util.function.Supplier<C> supplier)
Batch elements in a Stream by size into a toX created by the
supplied factory
|
ReactiveSeq<ListX<T>> |
groupedBySizeAndTime(int size,
long time,
java.util.concurrent.TimeUnit t)
Batch elements by size into a List
|
<C extends java.util.Collection<? super T>> |
groupedBySizeAndTime(int size,
long time,
java.util.concurrent.TimeUnit unit,
java.util.function.Supplier<C> factory)
Batch elements by size into a toX created by the supplied factory
|
<C extends java.util.Collection<? super T>,R> |
groupedBySizeAndTime(int size,
long time,
java.util.concurrent.TimeUnit unit,
java.util.function.Supplier<C> factory,
java.util.function.Function<? super C,? extends R> finalizer) |
ReactiveSeq<ListX<T>> |
groupedByTime(long time,
java.util.concurrent.TimeUnit t)
Batch elements in a Stream by time period
|
<C extends java.util.Collection<? super T>> |
groupedByTime(long time,
java.util.concurrent.TimeUnit unit,
java.util.function.Supplier<C> factory)
Batch elements by time into a toX created by the supplied factory
|
<C extends java.util.Collection<? super T>,R> |
groupedByTime(long time,
java.util.concurrent.TimeUnit unit,
java.util.function.Supplier<C> factory,
java.util.function.Function<? super C,? extends R> finalizer) |
<C extends java.util.Collection<T>,R> |
groupedStatefullyUntil(java.util.function.BiPredicate<C,? super T> predicate,
java.util.function.Supplier<C> factory,
java.util.function.Function<? super C,? extends R> finalizer) |
ReactiveSeq<ListX<T>> |
groupedStatefullyUntil(java.util.function.BiPredicate<ListX<? super T>,? super T> predicate)
Create ReactiveSeq of ListX where
each ListX is populated while the supplied bipredicate holds.
|
ListT<Witness.reactiveSeq,T> |
groupedStatefullyUntilT(java.util.function.BiPredicate<ListX<? super T>,? super T> predicate)
List Transformer view into batched Lists where
each List is populated while the supplied bipredicate holds.
|
<C extends java.util.Collection<T>,R> |
groupedStatefullyWhile(java.util.function.BiPredicate<C,? super T> predicate,
java.util.function.Supplier<C> factory,
java.util.function.Function<? super C,? extends R> finalizer) |
ReactiveSeq<ListX<T>> |
groupedStatefullyWhile(java.util.function.BiPredicate<ListX<? super T>,? super T> predicate) |
ListT<Witness.reactiveSeq,T> |
groupedT(int groupSize)
Group the elements in this Traversable into batches of the provided size.
|
ListT<Witness.reactiveSeq,T> |
groupedUntilT(java.util.function.Predicate<? super T> predicate)
Create a Traversable batched by List, where each batch is populated until
the predicate holds.
|
ReactiveSeq<ListX<T>> |
groupedWhile(java.util.function.Predicate<? super T> predicate)
Create a ReactiveSeq batched by List, where each batch is populated while
the predicate holds
|
<C extends java.util.Collection<? super T>> |
groupedWhile(java.util.function.Predicate<? super T> predicate,
java.util.function.Supplier<C> factory)
Create a ReactiveSeq batched by a Collection, where each batch is populated
while the predicate holds
|
ListT<Witness.reactiveSeq,T> |
groupedWhileT(java.util.function.Predicate<? super T> predicate)
Create a Traversable batched by List, where each batch is populated while
the predicate holds.
|
HeadAndTail<T> |
headAndTail()
extract head and tail together, where head is expected to be present
Example :
|
boolean |
isParallel() |
java.util.Iterator<T> |
iterator() |
ReactiveSeq<T> |
jitter(long maxJitterPeriodInNanos)
Introduce a random jitter / time delay between the emission of elements
|
java.lang.String |
join()
assertEquals("123".length(),ReactiveSeq.of(1, 2, 3).join().length());
|
java.lang.String |
join(java.lang.String sep)
assertEquals("1, 2, 3".length(), ReactiveSeq.of(1, 2, 3).join(", ").length());
|
java.lang.String |
join(java.lang.String sep,
java.lang.String start,
java.lang.String end)
assertEquals("^1|2|3$".length(), of(1, 2, 3).join("|", "^", "$").length());
|
ReactiveSeq<T> |
limit(long num)
assertThat(ReactiveSeq.of(4,3,6,7).limit(2).toList(),equalTo(Arrays.asList(4,3)); |
ReactiveSeq<T> |
limit(long time,
java.util.concurrent.TimeUnit unit)
Return all elements until specified time period has elapsed
|
ReactiveSeq<T> |
limitLast(int num)
Limit results to the last x elements in a ReactiveSeq
|
ReactiveSeq<T> |
limitUntil(java.util.function.Predicate<? super T> p)
Take elements from the Stream until the predicate returns true, after
which all elements are excluded.
|
ReactiveSeq<T> |
limitUntilClosed(java.util.function.Predicate<? super T> p) |
ReactiveSeq<T> |
limitWhile(java.util.function.Predicate<? super T> p)
Take elements from the Stream while the predicate holds, once the
predicate returns false all subsequent elements are excluded
|
ReactiveSeq<T> |
limitWhileClosed(java.util.function.Predicate<? super T> p) |
<R> ReactiveSeq<R> |
map(java.util.function.Function<? super T,? extends R> fn)
Transform this functor using the supplied transformation function
|
<R> R |
mapReduce(java.util.function.Function<? super T,? extends R> mapper,
Monoid<R> reducer)
Attempt to map this Monad to the same type as the supplied Monoid, using
supplied function Then use Monoid to reduce values
|
<R> R |
mapReduce(Reducer<R> reducer)
Attempt to map this Sequence to the same type as the supplied Monoid
(Reducer) Then use Monoid to reduce values
|
boolean |
noneMatch(java.util.function.Predicate<? super T> c) |
ReactiveSeq<T> |
onClose(java.lang.Runnable closeHandler) |
ReactiveSeq<T> |
onEmptyGet(java.util.function.Supplier<? extends T> supplier)
If this Container instance is zero, create a new instance containing the value returned from the provided Supplier
|
ReactiveSeq<T> |
onEmptySwitch(java.util.function.Supplier<? extends java.util.stream.Stream<T>> switchTo)
If this ReactiveSeq is empty one it with a another Stream
|
<X extends java.lang.Throwable> |
onEmptyThrow(java.util.function.Supplier<? extends X> supplier)
If this container instance is zero, throw the exception returned by the provided Supplier
|
ReactiveSeq<T> |
onePer(long time,
java.util.concurrent.TimeUnit t)
emit one element per time period
|
ReactiveSeq<T> |
parallel() |
org.jooq.lambda.tuple.Tuple2<ReactiveSeq<T>,ReactiveSeq<T>> |
partition(java.util.function.Predicate<? super T> splitter)
Partition a Stream into two one a per element basis, based on predicate's
boolean value
|
ReactiveSeq<T> |
prepend(java.lang.Iterable<? extends T> other) |
ReactiveSeq<T> |
prepend(T... values)
Prepend given values to the skip of the Stream
|
ReactiveSeq<T> |
prepend(T value) |
ReactiveSeq<T> |
prependS(java.util.stream.Stream<? extends T> stream)
Prepend Stream to this ReactiveSeq
|
org.jooq.lambda.tuple.Tuple4<ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>> |
quadruplicate()
Makes four copies of a Stream Buffers intermediate values, leaders may
change positions so a limit can be safely applied to the leading reactiveStream.
|
org.jooq.lambda.tuple.Tuple4<ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>> |
quadruplicate(java.util.function.Supplier<java.util.Deque<T>> bufferFactory) |
<EX extends java.lang.Throwable> |
recover(java.lang.Class<EX> exceptionClass,
java.util.function.Function<? super EX,? extends T> fn)
Recover from a particular exception type
|
ReactiveSeq<T> |
recover(java.util.function.Function<? super java.lang.Throwable,? extends T> fn)
Recover from an exception with an alternative value
|
java.util.Optional<T> |
reduce(java.util.function.BinaryOperator<T> accumulator)
An equivalent function to
Stream.reduce(BinaryOperator) |
ListX<T> |
reduce(java.lang.Iterable<? extends Monoid<T>> reducers)
Reduce with multiple reducers in parallel NB if this Monad is an Optional
[Arrays.asList(1,2,3)] reduce will operate on the Optional as if the list
was one value To reduce over the values on the list, called
streamedMonad() first.
|
T |
reduce(Monoid<T> reducer)
ReactiveSeq.of("hello","2","world","4").reduce(Reducers.toString(","));
//hello,2,world,4
|
ListX<T> |
reduce(java.util.stream.Stream<? extends Monoid<T>> reducers)
Reduce with multiple reducers in parallel NB if this Monad is an Optional
[Arrays.asList(1,2,3)] reduce will operate on the Optional as if the list
was one value To reduce over the values on the list, called
streamedMonad() first.
|
T |
reduce(T identity,
java.util.function.BinaryOperator<T> accumulator)
An equivalent function to
Stream.reduce(Object, BinaryOperator) |
<U> U |
reduce(U identity,
java.util.function.BiFunction<U,? super T,U> accumulator,
java.util.function.BinaryOperator<U> combiner)
An equivalent function to
Stream.reduce(Object, BiFunction, BinaryOperator) |
ReactiveSeq<T> |
reverse()
Potentially efficient Stream reversal.
|
<U> ReactiveSeq<U> |
scanLeft(U seed,
java.util.function.BiFunction<? super U,? super T,? extends U> function)
Scan left
|
ReactiveSeq<T> |
sequential() |
Maybe<T> |
single()
//Maybe[1]
ReactiveSeq.of(1).singleUnsafe();
//Maybe.none
ReactiveSeq.of().singleUnsafe();
//Maybe.none
ReactiveSeq.of(1,2,3).singleUnsafe();
|
Maybe<T> |
single(java.util.function.Predicate<? super T> predicate) |
T |
singleUnsafe()
//1
ReactiveSeq.of(1).singleUsafe();
//UnsupportedOperationException
ReactiveSeq.of().singleUnsafe();
//UnsupportedOperationException
ReactiveSeq.of(1,2,3).singleUnsafe();
|
ReactiveSeq<T> |
skip(long num)
assertThat(ReactiveSeq.of(4,3,6,7).skip(2).toList(),equalTo(Arrays.asList(6,7))); |
ReactiveSeq<T> |
skip(long time,
java.util.concurrent.TimeUnit unit)
Skip all elements until specified time period has passed
|
ReactiveSeq<T> |
skipLast(int num)
assertThat(ReactiveSeq.of(1,2,3,4,5) .skipLast(2)
.collect(CyclopsCollectors.toList()),equalTo(Arrays.asList(1,2,3)));
|
ReactiveSeq<T> |
skipWhile(java.util.function.Predicate<? super T> p)
SkipWhile drops elements from the Stream while the predicate holds, once
the predicte returns true all subsequent elements are included *
|
ReactiveSeq<T> |
skipWhileClosed(java.util.function.Predicate<? super T> predicate) |
ReactiveSeq<VectorX<T>> |
sliding(int windowSize,
int increment)
Create a sliding view over this Sequence
|
ListT<Witness.reactiveSeq,T> |
slidingT(int windowSize)
Create a Sliding window into the data in this traversble.
|
ListT<Witness.reactiveSeq,T> |
slidingT(int windowSize,
int increment)
Create a Sliding window into the data in this traversble.
|
ReactiveSeq<T> |
sorted()
assertThat(ReactiveSeq.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7))); |
org.jooq.lambda.tuple.Tuple2<ReactiveSeq<T>,ReactiveSeq<T>> |
splitAt(int where)
Split at supplied location
|
org.jooq.lambda.tuple.Tuple2<java.util.Optional<T>,ReactiveSeq<T>> |
splitAtHead()
Split a Stream at it's head (similar to headAndTail)
|
org.jooq.lambda.tuple.Tuple2<ReactiveSeq<T>,ReactiveSeq<T>> |
splitBy(java.util.function.Predicate<T> splitter)
Split reactiveStream at point where predicate no longer holds
|
java.util.Spliterator<T> |
spliterator()
Returns a spliterator for the elements of this reactiveStream.
|
boolean |
startsWith(java.util.stream.Stream<T> stream)
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Stream.of(1,2,3))) |
boolean |
startsWithIterable(java.lang.Iterable<T> iterable)
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Arrays.asList(1,2,3)));
|
ReactiveSeq<T> |
stream()
Convert this ReactiveSeq into a Stream
|
void |
subscribe(org.reactivestreams.Subscriber<? super T> s) |
java.lang.Object[] |
toArray() |
<A> A[] |
toArray(java.util.function.IntFunction<A[]> generator) |
org.jooq.lambda.tuple.Tuple3<ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>> |
triplicate()
Triplicates a Stream Buffers intermediate values, leaders may change
positions so a limit can be safely applied to the leading reactiveStream.
|
org.jooq.lambda.tuple.Tuple3<ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>> |
triplicate(java.util.function.Supplier<java.util.Deque<T>> bufferFactory) |
<T1> ReactiveSeq<T1> |
unit(T1 unit) |
<U> Traversable<U> |
unitIterator(java.util.Iterator<U> U)
Create an IterableFunctor instance of the same type from an Iterator
|
ReactiveSeq<T> |
unordered() |
<R> R |
visit(java.util.function.Function<? super ReactiveSeq<T>,? extends R> sync,
java.util.function.Function<? super ReactiveSeq<T>,? extends R> reactiveStreams,
java.util.function.Function<? super ReactiveSeq<T>,? extends R> asyncNoBackPressure) |
boolean |
xMatch(int num,
java.util.function.Predicate<? super T> c)
Check that there are specified number of matches of predicate in the
Stream
|
ReactiveSeq<T> |
xPer(int x,
long time,
java.util.concurrent.TimeUnit t)
emit x elements per time period
|
<S,U> ReactiveSeq<org.jooq.lambda.tuple.Tuple3<T,S,U>> |
zip3(java.lang.Iterable<? extends S> second,
java.lang.Iterable<? extends U> third)
zip 3 Streams into one
|
<T2,T3,T4> ReactiveSeq<org.jooq.lambda.tuple.Tuple4<T,T2,T3,T4>> |
zip4(java.lang.Iterable<? extends T2> second,
java.lang.Iterable<? extends T3> third,
java.lang.Iterable<? extends T4> fourth)
zip 4 Streams into 1
|
<U,R> ReactiveSeq<R> |
zipLatest(org.reactivestreams.Publisher<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> zipper) |
<U> ReactiveSeq<org.jooq.lambda.tuple.Tuple2<T,U>> |
zipP(org.reactivestreams.Publisher<? extends U> other) |
<U,R> ReactiveSeq<R> |
zipP(org.reactivestreams.Publisher<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
Zip (combine) this Zippable with the supplied Publisher, using the supplied combining function
|
<U> ReactiveSeq<org.jooq.lambda.tuple.Tuple2<T,U>> |
zipS(java.util.stream.Stream<? extends U> other)
Zip 2 streams into one
|
<U,R> ReactiveSeq<R> |
zipS(java.util.stream.Stream<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
Zip (combine) this Zippable with the supplied Stream, using the supplied combining function
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitallTypeclasses, allTypeclasses, ambWith, ambWith, backpressureAware, broadcast, cast, collectAll, combinations, combinations, combinationsT, combinationsT, combine, combine, concat, concat, concat, concat, concatDoubles, concatInts, concatLongs, coproduct, crossJoin, cycle, cycleUntil, cycleWhile, deferred, deferredI, deferredP, deleteBetween, doubles, drop, dropRight, dropUntil, dropWhile, elapsed, elementAt, empty, enqueued, enqueued, enqueued, enqueuedAll, enums, enums, enums, enumsFromTo, fanOut, fanOut, fanOut, fanOutZipIn, fanOutZipIn, fanOutZipIn, fill, filterInts, filterLongs, filterLongs, filterNot, flatMapDoubles, flatMapInts, flatMapLongs, flatten, flattenI, flattenO, foldJool, foldParallel, foldParallel, forEach2, forEach2, forEach3, forEach3, forEach4, forEach4, fromCharSequence, fromDoubleStream, fromIntStream, fromIterable, fromIterator, fromList, fromLongStream, fromPublisher, fromSpliterator, fromStream, generate, generate, get, groupBy, grouped, grouped, groupedUntil, groupedUntil, hotStream, insertAt, insertAtS, intersperse, ints, isEmpty, isReplayable, iterate, iterate, jool, kindCokleisli, kindKleisli, liftM, limitDouble, limitInts, limitLongs, longs, mapDoubles, mapInts, mapLongs, mapM, mapToDouble, mapToInt, mapToLong, max, merge, mergeP, mergeP, min, multicast, narrowK, nested, notNull, of, of, ofDoubles, ofInts, ofLongs, ofNullable, ofType, onEmpty, oneShotList, oneShotStream, parallel, parallel, parallelFanOut, parallelFanOut, parallelFanOut, parallelFanOutZipIn, parallelFanOutZipIn, parallelFanOutZipIn, pausableHotStream, peek, permutations, permutationsT, primedHotStream, primedPausableHotStream, print, print, printErr, printOut, product, product, publishTo, publishTo, range, range, rangeLong, rangeLong, reactiveSeq, reduce, reduceAll, remove, removeAll, removeAllI, removeAllS, retainAll, retainAllI, retainAllS, retry, retry, reversedListOf, reversedOf, scanLeft, scanRight, scanRight, schedule, scheduleFixedDelay, scheduleFixedRate, seq, shuffle, shuffle, size, skipDoubles, skipInts, skipLongs, skipUntil, skipUntilClosed, slice, sliding, sorted, sorted, sorted, subStream, tailRec, take, takeOne, takeRight, takeUntil, takeWhile, timestamp, toList, toSet, trampoline, unfold, unzip, unzip3, unzip4, widen, zip, zip, zip, zip3, zip4, zipWith, zipWithIndex, zipWithP, zipWithSasFunction, foldFuture, foldLazy, foldTry, forEach, forEach, forEach, forEach, forEach, runFuture, runLazy, toListX, toSetX, visitcollectors, commonPrefix, commonSuffix, count, countDistinct, countDistinct, countDistinctBy, countDistinctBy, maxBy, minBy, mode, sum, sumDouble, sumInt, sumLong, to, toMap, toMap, toString, toStringfoldLeft, foldLeft, foldLeft, foldLefttraversablepublic <R> FluxReactiveSeq<R> flux(reactor.core.publisher.Flux<R> flux)
public <R> FluxReactiveSeq<R> flux(ReactiveSeq<R> flux)
public <R> ReactiveSeq<R> coflatMap(java.util.function.Function<? super ReactiveSeq<T>,? extends R> fn)
ReactiveSeq
ReactiveSeq.of(1,2,3)
.map(i->i*2)
.coflatMap(s -> s.reduce(0,(a,b)->a+b))
//ReactiveSeq[12]
coflatMap in interface ReactiveSeq<T>public <T1> ReactiveSeq<T1> unit(T1 unit)
public <U> U foldRight(U identity,
java.util.function.BiFunction<? super T,? super U,? extends U> accumulator)
Foldspublic <U,R> ReactiveSeq<R> zipS(java.util.stream.Stream<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
ZippablezipS in interface Traversable<T>zipS in interface Zippable<T>zipS in interface ReactiveSeq<T>other - Stream to combine withzipper - Zip / combining functionpublic <U,R> ReactiveSeq<R> zipLatest(org.reactivestreams.Publisher<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
zipLatest in interface ReactiveSeq<T>public <U,R> ReactiveSeq<R> zipP(org.reactivestreams.Publisher<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
ZippablezipP in interface Traversable<T>zipP in interface Zippable<T>zipP in interface ReactiveSeq<T>other - to combine withzipper - Zip / combining functionpublic <U> ReactiveSeq<org.jooq.lambda.tuple.Tuple2<T,U>> zipP(org.reactivestreams.Publisher<? extends U> other)
zipP in interface Traversable<T>zipP in interface Zippable<T>zipP in interface ReactiveSeq<T>public ReactiveSeq<T> cycle()
ReactiveSeq
ReactiveSeq.of(1).cycle().limit(6).toList());
//List[1, 1, 1, 1, 1,1]
cycle in interface ReactiveSeq<T>public org.jooq.lambda.tuple.Tuple2<ReactiveSeq<T>,ReactiveSeq<T>> duplicate()
ReactiveSeq
Tuple2<ReactiveSeq<Integer>, ReactiveSeq<Integer>> copies = of(1, 2, 3, 4, 5, 6)
.duplicate();
assertTrue(copies.v1.anyMatch(i > i == 2));
assertTrue(copies.v2.anyMatch(i > i == 2));
duplicate in interface ReactiveSeq<T>public org.jooq.lambda.tuple.Tuple2<ReactiveSeq<T>,ReactiveSeq<T>> duplicate(java.util.function.Supplier<java.util.Deque<T>> bufferFactory)
duplicate in interface ReactiveSeq<T>public org.jooq.lambda.tuple.Tuple3<ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>> triplicate()
ReactiveSeq
Tuple3<ReactiveSeq<Tuple3<T1, T2, T3>>, ReactiveSeq<Tuple3<T1, T2, T3>>, ReactiveSeq<Tuple3<T1, T2, T3>>> Tuple3 = sequence.triplicate();
triplicate in interface ReactiveSeq<T>public org.jooq.lambda.tuple.Tuple3<ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>> triplicate(java.util.function.Supplier<java.util.Deque<T>> bufferFactory)
triplicate in interface ReactiveSeq<T>public org.jooq.lambda.tuple.Tuple4<ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>> quadruplicate()
ReactiveSeq
Tuple4<ReactiveSeq<Tuple4<T1, T2, T3, T4>>,
ReactiveSeq<Tuple4<T1, T2, T3, T4>>,
ReactiveSeq<Tuple4<T1, T2, T3, T4>>,
ReactiveSeq<Tuple4<T1, T2, T3, T4>>> quad = sequence.quadruplicate();
quadruplicate in interface ReactiveSeq<T>public org.jooq.lambda.tuple.Tuple4<ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>,ReactiveSeq<T>> quadruplicate(java.util.function.Supplier<java.util.Deque<T>> bufferFactory)
quadruplicate in interface ReactiveSeq<T>public org.jooq.lambda.tuple.Tuple2<java.util.Optional<T>,ReactiveSeq<T>> splitAtHead()
ReactiveSeq
ReactiveSeq.of(1,2,3)
.splitAtHead()
//Optional[1], ReactiveSeq[2,3]
splitAtHead in interface ReactiveSeq<T>public org.jooq.lambda.tuple.Tuple2<ReactiveSeq<T>,ReactiveSeq<T>> splitAt(int where)
ReactiveSeq
ReactiveSeq.of(1,2,3)
.splitAt(1)
//ReactiveSeq[1], ReactiveSeq[2,3]
splitAt in interface ReactiveSeq<T>public org.jooq.lambda.tuple.Tuple2<ReactiveSeq<T>,ReactiveSeq<T>> splitBy(java.util.function.Predicate<T> splitter)
ReactiveSeq
ReactiveSeq.of(1, 2, 3, 4, 5, 6).splitBy(i->i<4)
//ReactiveSeq[1,2,3] ReactiveSeq[4,5,6]
splitBy in interface ReactiveSeq<T>public org.jooq.lambda.tuple.Tuple2<ReactiveSeq<T>,ReactiveSeq<T>> partition(java.util.function.Predicate<? super T> splitter)
ReactiveSeq
ReactiveSeq.of(1, 2, 3, 4, 5, 6).partition(i -> i % 2 != 0)
//ReactiveSeq[1,3,5], ReactiveSeq[2,4,6]
partition in interface ReactiveSeq<T>public <U> ReactiveSeq<org.jooq.lambda.tuple.Tuple2<T,U>> zipS(java.util.stream.Stream<? extends U> other)
ReactiveSeq
List<Tuple2<Integer, String>> list = of(1, 2).zip(of("a", "b", "c", "d")).toList();
// [[1,"a"],[2,"b"]]
zipS in interface Traversable<T>zipS in interface Zippable<T>zipS in interface ReactiveSeq<T>other - Stream to combine withpublic <S,U> ReactiveSeq<org.jooq.lambda.tuple.Tuple3<T,S,U>> zip3(java.lang.Iterable<? extends S> second, java.lang.Iterable<? extends U> third)
ReactiveSeq
List<Tuple3<Integer, Integer, Character>> list = of(1, 2, 3, 4, 5, 6).zip3(of(100, 200, 300, 400), of('a', 'b', 'c')).collect(CyclopsCollectors.toList());
// [[1,100,'a'],[2,200,'b'],[3,300,'c']]
zip3 in interface Traversable<T>zip3 in interface Zippable<T>zip3 in interface ReactiveSeq<T>public <T2,T3,T4> ReactiveSeq<org.jooq.lambda.tuple.Tuple4<T,T2,T3,T4>> zip4(java.lang.Iterable<? extends T2> second, java.lang.Iterable<? extends T3> third, java.lang.Iterable<? extends T4> fourth)
ReactiveSeq
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(CyclopsCollectors.toList());
// [[1,100,'a',"hello"],[2,200,'b',"world"]]
zip4 in interface Traversable<T>zip4 in interface Zippable<T>zip4 in interface ReactiveSeq<T>public ReactiveSeq<VectorX<T>> sliding(int windowSize, int increment)
ReactiveSeq
List<List<Integer>> list = ReactiveSeq.of(1, 2, 3, 4, 5, 6).sliding(3, 2).collect(CyclopsCollectors.toList());
assertThat(list.get(0), hasItems(1, 2, 3));
assertThat(list.get(1), hasItems(3, 4, 5));
sliding in interface Traversable<T>sliding in interface ReactiveSeq<T>windowSize - number of elements in each batchincrement - for each windowpublic ReactiveSeq<ListX<T>> grouped(int groupSize)
ReactiveSeq
List<List<Integer>> list = ReactiveSeq.of(1, 2, 3, 4, 5, 6).grouped(3).collect(CyclopsCollectors.toList());
assertThat(list.get(0), hasItems(1, 2, 3));
assertThat(list.get(1), hasItems(4, 5, 6));
grouped in interface Traversable<T>grouped in interface ReactiveSeq<T>groupSize - Size of each Grouppublic ReactiveSeq<ListX<T>> groupedStatefullyUntil(java.util.function.BiPredicate<ListX<? super T>,? super T> predicate)
ReactiveSeq
ReactiveSeq.of(1,2,3,4,5,6)
.groupedStatefullyUntil((s,i)-> s.contains(4) ? true : false)
.toList()
.size()
//5
groupedStatefullyUntil in interface Traversable<T>groupedStatefullyUntil in interface ReactiveSeq<T>predicate - Window while truepublic <C extends java.util.Collection<T>,R> ReactiveSeq<R> groupedStatefullyUntil(java.util.function.BiPredicate<C,? super T> predicate, java.util.function.Supplier<C> factory, java.util.function.Function<? super C,? extends R> finalizer)
groupedStatefullyUntil in interface ReactiveSeq<T>public ReactiveSeq<ListX<T>> groupedStatefullyWhile(java.util.function.BiPredicate<ListX<? super T>,? super T> predicate)
groupedStatefullyWhile in interface ReactiveSeq<T>public <C extends java.util.Collection<T>,R> ReactiveSeq<R> groupedStatefullyWhile(java.util.function.BiPredicate<C,? super T> predicate, java.util.function.Supplier<C> factory, java.util.function.Function<? super C,? extends R> finalizer)
groupedStatefullyWhile in interface ReactiveSeq<T>public ReactiveSeq<ListX<T>> groupedBySizeAndTime(int size, long time, java.util.concurrent.TimeUnit t)
ReactiveSeq
ReactiveSeq.of(1,2,3,4,5,6)
.groupedBySizeAndTime(3,10,TimeUnit.SECONDS)
.toList();
//[[1,2,3],[4,5,6]]
groupedBySizeAndTime in interface ReactiveSeq<T>size - Max size of a batchtime - (Max) time period to build a singleUnsafe batch int - time unit for batchpublic <C extends java.util.Collection<? super T>> ReactiveSeq<C> groupedBySizeAndTime(int size, long time, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<C> factory)
ReactiveSeq
ReactiveSeq.of(1,2,3,4,5,6)
.groupedBySizeAndTime(3,10,TimeUnit.SECONDS,()->SetX.empty())
.toList();
//[[1,2,3],[4,5,6]]
groupedBySizeAndTime in interface ReactiveSeq<T>size - Max size of a batchtime - (Max) time period to build a singleUnsafe batch inunit - time unit for batchfactory - Collection factorypublic <C extends java.util.Collection<? super T>,R> ReactiveSeq<R> groupedBySizeAndTime(int size, long time, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<C> factory, java.util.function.Function<? super C,? extends R> finalizer)
groupedBySizeAndTime in interface ReactiveSeq<T>public <C extends java.util.Collection<? super T>,R> ReactiveSeq<R> groupedByTime(long time, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<C> factory, java.util.function.Function<? super C,? extends R> finalizer)
groupedByTime in interface ReactiveSeq<T>public ReactiveSeq<ListX<T>> groupedByTime(long time, java.util.concurrent.TimeUnit t)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5,6).batchByTime(1,TimeUnit.SECONDS).collect(CyclopsCollectors.toList()).size(),is(1));
assertThat(ReactiveSeq.of(1,2,3,4,5,6).batchByTime(1,TimeUnit.NANOSECONDS).collect(CyclopsCollectors.toList()).size(),greaterThan(5));
groupedByTime in interface ReactiveSeq<T>time - - time period to build a singleUnsafe batch int - time unit for batchpublic <C extends java.util.Collection<? super T>> ReactiveSeq<C> groupedByTime(long time, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<C> factory)
ReactiveSeq
assertThat(ReactiveSeq.of(1,1,1,1,1,1)
.batchByTime(1500,TimeUnit.MICROSECONDS,()-> new TreeSet<>())
.toList()
.get(0)
.size(),is(1));
groupedByTime in interface ReactiveSeq<T>time - - time period to build a singleUnsafe batch inunit - time unit for batchfactory - Collection factorypublic <C extends java.util.Collection<? super T>> ReactiveSeq<C> grouped(int size, java.util.function.Supplier<C> supplier)
ReactiveSeq
assertThat(ReactiveSeq.of(1,1,1,1,1,1)
.batchBySize(3,()->new TreeSet<>())
.toList()
.get(0)
.size(),is(1));
grouped in interface Traversable<T>grouped in interface ReactiveSeq<T>size - batch sizesupplier - Collection factorypublic ReactiveSeq<ListX<T>> groupedWhile(java.util.function.Predicate<? super T> predicate)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.batchWhile(i->i%3!=0)
.toList().size(),equalTo(2));
groupedWhile in interface Traversable<T>groupedWhile in interface ReactiveSeq<T>predicate - Batch while predicate holds, applyHKT open next batchpublic <C extends java.util.Collection<? super T>> ReactiveSeq<C> groupedWhile(java.util.function.Predicate<? super T> predicate, java.util.function.Supplier<C> factory)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.batchWhile(i->i%3!=0)
.toList()
.size(),equalTo(2));
groupedWhile in interface Traversable<T>groupedWhile in interface ReactiveSeq<T>predicate - Batch while predicate holds, applyHKT open next batchfactory - Collection factorypublic ReactiveSeq<T> distinct()
distinct in interface Traversable<T>distinct in interface ReactiveSeq<T>distinct in interface java.util.stream.Stream<T>public <U> ReactiveSeq<U> scanLeft(U seed, java.util.function.BiFunction<? super U,? super T,? extends U> function)
ReactiveSeq
assertThat(of("a", "b", "c").scanLeft("", String::concat).toList().size(),
is(4));
scanLeft in interface Traversable<T>scanLeft in interface ReactiveSeq<T>public ReactiveSeq<T> sorted()
ReactiveSeq
assertThat(ReactiveSeq.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7)));
sorted in interface Traversable<T>sorted in interface ReactiveSeq<T>sorted in interface java.util.stream.Stream<T>public ReactiveSeq<T> skip(long num)
ReactiveSeq
assertThat(ReactiveSeq.of(4,3,6,7).skip(2).toList(),equalTo(Arrays.asList(6,7)));
skip in interface Traversable<T>skip in interface ReactiveSeq<T>skip in interface java.util.stream.Stream<T>num - Number of elemenets to skippublic void forEach(java.util.function.Consumer<? super T> action)
ReactiveSeqReactiveSeq.forEachAsync(Consumer) and forEach overloads
such as FoldableTraversable.forEach(Consumer, Consumer) and FoldableTraversable.forEach(Consumer, Consumer,Runnable)
This method overrides the JDK Stream.forEach(Consumer) and maintains it's blocking
semantics. Other forEach overloads in ReactiveSeq are non-blocking for asynchronously executing Streams.
This is a terminal operation.
The behavior of this operation is explicitly nondeterministic. For parallel reactiveStream pipelines, this operation does not guarantee to respect the encounter order of the reactiveStream, as doing so would sacrifice the benefit of parallelism. For any given element, the action may be performed at whatever time and in whatever thread the library chooses. If the action accesses shared state, it is responsible for providing the required synchronization.
forEach in interface ReactiveSeq<T>forEach in interface java.lang.Iterable<T>forEach in interface java.util.stream.Stream<T>action - a
non-interfering action to perform on the elementspublic void forEachOrdered(java.util.function.Consumer<? super T> action)
forEachOrdered in interface java.util.stream.Stream<T>public java.lang.Object[] toArray()
toArray in interface java.util.stream.Stream<T>public <A> A[] toArray(java.util.function.IntFunction<A[]> generator)
toArray in interface java.util.stream.Stream<T>public ReactiveSeq<T> skipWhile(java.util.function.Predicate<? super T> p)
ReactiveSeq
assertThat(ReactiveSeq.of(4,3,6,7).sorted().skipWhile(i->i<6).toList(),equalTo(Arrays.asList(6,7)));
skipWhile in interface Traversable<T>skipWhile in interface ReactiveSeq<T>p - Predicate to skip while truepublic ReactiveSeq<T> limit(long num)
ReactiveSeq
assertThat(ReactiveSeq.of(4,3,6,7).limit(2).toList(),equalTo(Arrays.asList(4,3));
limit in interface Traversable<T>limit in interface ReactiveSeq<T>limit in interface java.util.stream.Stream<T>num - Limit element size to numpublic ReactiveSeq<T> limitWhile(java.util.function.Predicate<? super T> p)
ReactiveSeq
assertThat(ReactiveSeq.of(4,3,6,7).sorted().limitWhile(i->i<6).toList(),equalTo(Arrays.asList(3,4)));
limitWhile in interface Traversable<T>limitWhile in interface ReactiveSeq<T>p - Limit while predicate is truepublic ReactiveSeq<T> limitWhileClosed(java.util.function.Predicate<? super T> p)
limitWhileClosed in interface ReactiveSeq<T>public ReactiveSeq<T> limitUntil(java.util.function.Predicate<? super T> p)
ReactiveSeq
assertThat(ReactiveSeq.of(4,3,6,7).limitUntil(i->i==6).toList(),equalTo(Arrays.asList(4,3)));
limitUntil in interface Traversable<T>limitUntil in interface ReactiveSeq<T>p - Limit until predicate is truepublic ReactiveSeq<T> limitUntilClosed(java.util.function.Predicate<? super T> p)
limitUntilClosed in interface ReactiveSeq<T>public ReactiveSeq<T> parallel()
parallel in interface ReactiveSeq<T>parallel in interface java.util.stream.BaseStream<T,java.util.stream.Stream<T>>public boolean allMatch(java.util.function.Predicate<? super T> c)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5).allMatch(it-> it>0 && it <6),equalTo(true));
allMatch in interface CyclopsCollectable<T>allMatch in interface ReactiveSeq<T>allMatch in interface java.util.stream.Stream<T>c - Predicate to check if all matchpublic boolean anyMatch(java.util.function.Predicate<? super T> c)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5).anyMatch(it-> it.equals(3)),equalTo(true));
anyMatch in interface CyclopsCollectable<T>anyMatch in interface ReactiveSeq<T>anyMatch in interface java.util.stream.Stream<T>c - Predicate to check if any matchpublic boolean xMatch(int num,
java.util.function.Predicate<? super T> c)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,5,6,7).xMatch(3, i-> i>4 ));
public boolean noneMatch(java.util.function.Predicate<? super T> c)
noneMatch in interface CyclopsCollectable<T>noneMatch in interface ReactiveSeq<T>noneMatch in interface java.util.stream.Stream<T>public java.lang.String join()
ReactiveSeq
assertEquals("123".length(),ReactiveSeq.of(1, 2, 3).join().length());
public java.lang.String join(java.lang.String sep)
ReactiveSeq
assertEquals("1, 2, 3".length(), ReactiveSeq.of(1, 2, 3).join(", ").length());
public java.lang.String join(java.lang.String sep,
java.lang.String start,
java.lang.String end)
ReactiveSeq
assertEquals("^1|2|3$".length(), of(1, 2, 3).join("|", "^", "$").length());
public HeadAndTail<T> headAndTail()
FoldableTraversable
ReactiveSeq<String> helloWorld = ReactiveSeq.Of("hello","world","last");
HeadAndTail<String> headAndTail = helloWorld.headAndTail();
String head = headAndTail.head();
//head == "hello"
ReactiveSeq<String> tail = headAndTail.tail();
//["world","last]
headAndTail in interface FoldableTraversable<T>headAndTail in interface ReactiveSeq<T>public java.util.Optional<T> findFirst()
public Maybe<T> findOne()
ReactiveSeqfindOne in interface ReactiveSeq<T>public Either<java.lang.Throwable,T> findFirstOrError()
ReactiveSeqfindFirstOrError in interface ReactiveSeq<T>public java.util.Optional<T> findAny()
findAny in interface Folds<T>findAny in interface ReactiveSeq<T>findAny in interface java.util.stream.Stream<T>
ReactiveSeq.of(1,2,3,4,5).filter(it -> it <3).findAny().get();
//3
(non-deterministic)public <R> R mapReduce(Reducer<R> reducer)
ReactiveSeq
ReactiveSeq.of("hello","2","world","4").mapReduce(Reducers.toCountInt());
//4
public <R> R mapReduce(java.util.function.Function<? super T,? extends R> mapper, Monoid<R> reducer)
ReactiveSeq
ReactiveSeq.of("one","two","three","four")
.mapReduce(this::toInt,Reducers.toTotalInt());
//10
int toInt(String s){
if("one".equals(s))
return 1;
if("two".equals(s))
return 2;
if("three".equals(s))
return 3;
if("four".equals(s))
return 4;
return -1;
}
public T reduce(Monoid<T> reducer)
ReactiveSeq
ReactiveSeq.of("hello","2","world","4").reduce(Reducers.toString(","));
//hello,2,world,4
public java.util.Optional<T> reduce(java.util.function.BinaryOperator<T> accumulator)
FoldsStream.reduce(BinaryOperator)
ReactiveSeq.of(1,2,3,4,5).map(it -> it*100).reduce(
(acc,next) -> acc+next)
//Optional[1500]
public T reduce(T identity, java.util.function.BinaryOperator<T> accumulator)
FoldsStream.reduce(Object, BinaryOperator)reduce in interface Folds<T>reduce in interface ReactiveSeq<T>reduce in interface java.util.stream.Stream<T>accumulator - Combiner functionpublic <U> U reduce(U identity,
java.util.function.BiFunction<U,? super T,U> accumulator,
java.util.function.BinaryOperator<U> combiner)
FoldsStream.reduce(Object, BiFunction, BinaryOperator)public ListX<T> reduce(java.util.stream.Stream<? extends Monoid<T>> reducers)
ReactiveSeq
Monoid<Integer> sum = Monoid.of(0, (a, b) -> a + b);
Monoid<Integer> mult = Monoid.of(1, (a, b) -> a * b);
List<Integer> result = ReactiveSeq.of(1, 2, 3, 4).reduce(Arrays.asList(sum, mult).reactiveStream());
assertThat(result, equalTo(Arrays.asList(10, 24)));
public ListX<T> reduce(java.lang.Iterable<? extends Monoid<T>> reducers)
ReactiveSeq
Monoid<Integer> sum = Monoid.of(0,(a,b)->a+b);
Monoid<Integer> mult = Monoid.of(1,(a,b)->a*b);
List<Integer> result = ReactiveSeq.of(1,2,3,4))
.reduce(Arrays.asList(sum,mult) );
assertThat(result,equalTo(Arrays.asList(10,24)));
public T foldRight(Monoid<T> reducer)
ReactiveSeq
ReactiveSeq.of("a","b","c").foldRight(Reducers.toString(""));
// "cab"
public T foldRight(T identity, java.util.function.BinaryOperator<T> accumulator)
ReactiveSeq
assertTrue(ReactiveSeq.of("a","b","c").foldRight("", String::concat).equals("cba"));
public <T1> T1 foldRightMapToType(Reducer<T1> reducer)
ReactiveSeq
ReactiveSeq.of(1,2,3).foldRightMapToType(Reducers.toString(""));
// "321"
foldRightMapToType in interface Folds<T>foldRightMapToType in interface ReactiveSeq<T>reducer - Monoid to reduce valuespublic ReactiveSeq<T> stream()
ReactiveSeqstream in interface Folds<T>stream in interface TransformerTraversable<T>stream in interface ExtendedTraversable<T>stream in interface FoldableTraversable<T>stream in interface Sequential<T>stream in interface Traversable<T>stream in interface ReactiveSeq<T>public <U> Traversable<U> unitIterator(java.util.Iterator<U> U)
Traversable
ReactiveSeq<Integer> newSeq = seq.unitIterable(myIterator);
unitIterator in interface Traversable<T>U - Iterator to create new IterableFunctor frompublic boolean startsWithIterable(java.lang.Iterable<T> iterable)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Arrays.asList(1,2,3)));
startsWithIterable in interface Folds<T>startsWithIterable in interface ReactiveSeq<T>public boolean startsWith(java.util.stream.Stream<T> stream)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Stream.of(1,2,3)))
startsWith in interface Folds<T>startsWith in interface ReactiveSeq<T>stream - Stream to check if this Folds has the same elements in the same order, at the skippublic AnyMSeq<Witness.reactiveSeq,T> anyM()
anyM in interface ReactiveSeq<T>public <R> ReactiveSeq<R> map(java.util.function.Function<? super T,? extends R> fn)
Transformable
of(1,2,3).map(i->i*2)
//[2,4,6]
map in interface FilterableTransformable<T>map in interface Transformable<T>map in interface ReactiveSeq<T>map in interface java.util.stream.Stream<T>fn - Transformation functionpublic <R> ReactiveSeq<R> flatMap(java.util.function.Function<? super T,? extends java.util.stream.Stream<? extends R>> fn)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2)
.flatMap(i -> asList(i, -i).reactiveStream())
.toList(),equalTo(asList(1, -1, 2, -2)));
flatMap in interface ReactiveSeq<T>flatMap in interface java.util.stream.Stream<T>fn - to be appliedpublic java.util.stream.IntStream flatMapToInt(java.util.function.Function<? super T,? extends java.util.stream.IntStream> mapper)
flatMapToInt in interface java.util.stream.Stream<T>public java.util.stream.LongStream flatMapToLong(java.util.function.Function<? super T,? extends java.util.stream.LongStream> mapper)
flatMapToLong in interface java.util.stream.Stream<T>public java.util.stream.DoubleStream flatMapToDouble(java.util.function.Function<? super T,? extends java.util.stream.DoubleStream> mapper)
flatMapToDouble in interface java.util.stream.Stream<T>public <R> ReactiveSeq<R> flatMapAnyM(java.util.function.Function<? super T,AnyM<Witness.stream,? extends R>> fn)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3)).flatMapAnyM(i-> fromEither5(CompletableFuture.completedFuture(i+2))).toList(),equalTo(Arrays.asList(3,4,5)));
flatMapAnyM in interface ReactiveSeq<T>fn - to be appliedpublic <R> ReactiveSeq<R> flatMapI(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> fn)
ReactiveSeq
ReactiveSeq.of(1,2)
.flatMap(i -> asList(i, -i))
.toList();
//1,-1,2,-2
flatMapI in interface ReactiveSeq<T>public <R> ReactiveSeq<R> flatMapP(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn)
flatMapP in interface ReactiveSeq<T>public <R> ReactiveSeq<R> flatMapP(int maxConcurrency, java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn)
flatMapP in interface ReactiveSeq<T>public <R> ReactiveSeq<R> flatMapStream(java.util.function.Function<? super T,java.util.stream.BaseStream<? extends R,?>> fn)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3)
.flatMapStream(i->IntStream.of(i))
.toList(),equalTo(Arrays.asList(1,2,3)));
flatMapStream in interface ReactiveSeq<T>fn - to be appliedpublic ReactiveSeq<T> filter(java.util.function.Predicate<? super T> fn)
Filters
of(1,2,3).filter(i->i>2);
//[3]
filter in interface Filters<T>filter in interface FilterableTransformable<T>filter in interface ReactiveSeq<T>filter in interface java.util.stream.Stream<T>fn - to filter elements by, retaining matchespublic java.util.Iterator<T> iterator()
public java.util.Spliterator<T> spliterator()
ReactiveSeq
This is a terminal operation.
spliterator in interface ReactiveSeq<T>spliterator in interface java.lang.Iterable<T>spliterator in interface java.util.stream.BaseStream<T,java.util.stream.Stream<T>>public boolean isParallel()
public ReactiveSeq<T> sequential()
sequential in interface ReactiveSeq<T>sequential in interface java.util.stream.BaseStream<T,java.util.stream.Stream<T>>public ReactiveSeq<T> unordered()
unordered in interface ReactiveSeq<T>unordered in interface java.util.stream.BaseStream<T,java.util.stream.Stream<T>>public ReactiveSeq<T> reverse()
Traversable assertThat( of(1, 2, 3).reverse().toList(),
equalTo(asList(3, 2, 1))); reverse in interface Traversable<T>reverse in interface ReactiveSeq<T>public ReactiveSeq<T> onClose(java.lang.Runnable closeHandler)
onClose in interface ReactiveSeq<T>onClose in interface java.util.stream.BaseStream<T,java.util.stream.Stream<T>>public void close()
public ReactiveSeq<T> prependS(java.util.stream.Stream<? extends T> stream)
ReactiveSeq
List<String> result = ReactiveSeq.of(1, 2, 3)
.prependS(of(100, 200, 300))
.map(it -> it + "!!")
.collect(CyclopsCollectors.toList());
assertThat(result, equalTo(Arrays.asList("100!!", "200!!", "300!!", "1!!", "2!!", "3!!")));
prependS in interface Traversable<T>prependS in interface ReactiveSeq<T>stream - to Prependpublic ReactiveSeq<T> append(T... values)
ReactiveSeq
List<String> result = ReactiveSeq.of(1, 2, 3).append(100, 200, 300).map(it -> it + "!!").collect(CyclopsCollectors.toList());
assertThat(result, equalTo(Arrays.asList("1!!", "2!!", "3!!", "100!!", "200!!", "300!!"))); *
append in interface Traversable<T>append in interface ReactiveSeq<T>values - to appendpublic ReactiveSeq<T> append(T value)
append in interface Traversable<T>append in interface ReactiveSeq<T>public ReactiveSeq<T> prepend(T value)
prepend in interface Traversable<T>prepend in interface ReactiveSeq<T>public ReactiveSeq<T> prepend(T... values)
ReactiveSeq
List<String> result = ReactiveSeq.of(1,2,3)
.prepend(100,200,300)
.map(it ->it+"!!")
.collect(CyclopsCollectors.toList());
assertThat(result,equalTo(Arrays.asList("100!!","200!!","300!!","1!!","2!!","3!!")));
prepend in interface Traversable<T>prepend in interface ReactiveSeq<T>values - to prependpublic boolean endsWithIterable(java.lang.Iterable<T> iterable)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Arrays.asList(5,6)));
endsWithIterable in interface Folds<T>endsWithIterable in interface ReactiveSeq<T>iterable - Values to checkpublic boolean endsWith(java.util.stream.Stream<T> stream)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Stream.of(5,6)));
public ReactiveSeq<T> skip(long time, java.util.concurrent.TimeUnit unit)
ReactiveSeq
List<Integer> result = ReactiveSeq.of(1, 2, 3, 4, 5, 6).peek(i -> sleep(i * 100)).skip(1000, TimeUnit.MILLISECONDS).toList();
// [4,5,6]
skip in interface ReactiveSeq<T>time - Length of timeunit - Time unitpublic ReactiveSeq<T> limit(long time, java.util.concurrent.TimeUnit unit)
ReactiveSeq
List<Integer> result = ReactiveSeq.of(1, 2, 3, 4, 5, 6).peek(i -> sleep(i * 100)).limit(1000, TimeUnit.MILLISECONDS).toList();
// [1,2,3,4]
limit in interface ReactiveSeq<T>time - Length of timeunit - Time unitpublic ReactiveSeq<T> skipLast(int num)
ReactiveSeqskipLast in interface Traversable<T>skipLast in interface ReactiveSeq<T>public ReactiveSeq<T> limitLast(int num)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5)
.limitLast(2)
.collect(CyclopsCollectors.toList()),equalTo(Arrays.asList(4,5)));
limitLast in interface Traversable<T>limitLast in interface ReactiveSeq<T>num - of elements to return (last elements)public T firstValue()
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4)
.map(u->{throw new RuntimeException();})
.recover(e->"hello")
.firstValue(),equalTo("hello"));
firstValue in interface Folds<T>firstValue in interface ReactiveSeq<T>public ReactiveSeq<T> onEmptySwitch(java.util.function.Supplier<? extends java.util.stream.Stream<T>> switchTo)
ReactiveSeq
assertThat(ReactiveSeq.of(4,5,6)
.onEmptySwitch(()->ReactiveSeq.of(1,2,3))
.toList(),
equalTo(Arrays.asList(4,5,6)));
onEmptySwitch in interface OnEmptySwitch<T,java.util.stream.Stream<T>>onEmptySwitch in interface ReactiveSeq<T>switchTo - Supplier that will generate the alternative Streampublic ReactiveSeq<T> onEmptyGet(java.util.function.Supplier<? extends T> supplier)
OnEmptyonEmptyGet in interface OnEmpty<T>onEmptyGet in interface Traversable<T>onEmptyGet in interface ReactiveSeq<T>supplier - to determine new value for containerpublic <X extends java.lang.Throwable> ReactiveSeq<T> onEmptyThrow(java.util.function.Supplier<? extends X> supplier)
OnEmptyonEmptyThrow in interface OnEmpty<T>onEmptyThrow in interface Traversable<T>onEmptyThrow in interface ReactiveSeq<T>supplier - to create exception frompublic <U> ReactiveSeq<T> distinct(java.util.function.Function<? super T,? extends U> keyExtractor)
distinct in interface ReactiveSeq<T>public ReactiveSeq<T> xPer(int x, long time, java.util.concurrent.TimeUnit t)
ReactiveSeq
code
SimpleTimer timer = new SimpleTimer();
ReactiveSeq.of(1, 2, 3, 4, 5, 6)
.xPer(6, 100000000, TimeUnit.NANOSECONDS)
.collect(CyclopsCollectors.toList())
.size();
//6
xPer in interface Sequential<T>xPer in interface ReactiveSeq<T>x - number of elements to emittime - periodt - Time unitpublic ReactiveSeq<T> onePer(long time, java.util.concurrent.TimeUnit t)
ReactiveSeq
ReactiveSeq.iterate("", last -> "next")
.limit(100)
.batchBySize(10)
.onePer(1, TimeUnit.MICROSECONDS)
.peek(batch -> System.out.println("batched : " + batch))
.flatMap(Collection::reactiveStream)
.peek(individual -> System.out.println("Flattened : "
+ individual))
.forEach(a->{});
onePer in interface Sequential<T>onePer in interface ReactiveSeq<T>time - periodt - Time unitpublic ReactiveSeq<T> debounce(long time, java.util.concurrent.TimeUnit t)
ReactiveSeq
ReactiveSeq.of(1,2,3,4,5,6)
.debounce(1000,TimeUnit.SECONDS).toList();
// 1
debounce in interface ReactiveSeq<T>time - Time to applyHKT debouncing overt - Time unit for debounce periodpublic ReactiveSeq<T> fixedDelay(long l, java.util.concurrent.TimeUnit unit)
ReactiveSeq
SimpleTimer timer = new SimpleTimer();
ReactiveSeq.of(1, 2, 3, 4, 5, 6)
.fixedDelay(10000, TimeUnit.NANOSECONDS)
.collect(CyclopsCollectors.toList())
.size();
//6
assertThat(timer.getElapsedNanoseconds(), greaterThan(60000l));
fixedDelay in interface Sequential<T>fixedDelay in interface ReactiveSeq<T>l - time length in nanos of the delayunit - for the delaypublic ReactiveSeq<T> jitter(long maxJitterPeriodInNanos)
ReactiveSeq
{ @code
SimpleTimer timer = new SimpleTimer();
ReactiveSeq.of(1, 2, 3, 4, 5, 6)
.jitter(10000)
.collect(CyclopsCollectors.toList());
assertThat(timer.getElapsedNanoseconds(), greaterThan(20000l));
}
jitter in interface ReactiveSeq<T>maxJitterPeriodInNanos - - random number less than this is used for each jitterpublic ReactiveSeq<T> complete(java.lang.Runnable fn)
ReactiveSeqcomplete in interface ReactiveSeq<T>fn - Function that accepts and returns completed valuepublic ReactiveSeq<T> recover(java.util.function.Function<? super java.lang.Throwable,? extends T> fn)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4)
.map(i->i+2)
.map(u->{throw new RuntimeException();})
.recover(e->"hello")
.firstValue(),equalTo("hello"));
recover in interface Traversable<T>recover in interface ReactiveSeq<T>fn - Function that accepts a Throwable and returns an alternative
valuepublic <EX extends java.lang.Throwable> ReactiveSeq<T> recover(java.lang.Class<EX> exceptionClass, java.util.function.Function<? super EX,? extends T> fn)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4)
.map(i->i+2)
.map(u->{ExceptionSoftener.throwSoftenedException( new IOException()); return null;})
.recover(IOException.class,e->"hello")
.firstValue(),equalTo("hello"));
recover in interface Traversable<T>recover in interface ReactiveSeq<T>exceptionClass - Type to recover fromfn - That accepts an error and returns an alternative valuepublic long count()
ReactiveSeq
return mapToLong(e -> 1L).sum();
This is a terminal operation.
count in interface CyclopsCollectable<T>count in interface ReactiveSeq<T>count in interface java.util.stream.Stream<T>public ReactiveSeq<T> appendS(java.util.stream.Stream<? extends T> other)
ReactiveSeq
List<String> result = ReactiveSeq.of(1, 2, 3).appendStream(ReactiveSeq.of(100, 200, 300)).map(it -> it + "!!").collect(CyclopsCollectors.toList());
assertThat(result, equalTo(Arrays.asList("1!!", "2!!", "3!!", "100!!", "200!!", "300!!"))); *
appendS in interface ReactiveSeq<T>public ReactiveSeq<T> append(java.lang.Iterable<? extends T> other)
append in interface ReactiveSeq<T>public ReactiveSeq<T> prepend(java.lang.Iterable<? extends T> other)
prepend in interface ReactiveSeq<T>public ReactiveSeq<T> cycle(long times)
ReactiveSeq
ReactiveSeq.of(1,2,2)
.cycle(3)
.collect(CyclopsCollectors.toList());
//List[1,2,2,1,2,2,1,2,2]
cycle in interface Traversable<T>cycle in interface ReactiveSeq<T>times - Times values should be repeated within a Streampublic ReactiveSeq<T> skipWhileClosed(java.util.function.Predicate<? super T> predicate)
skipWhileClosed in interface ReactiveSeq<T>public java.lang.String format()
format in interface ReactiveSeq<T>public ReactiveSeq<T> changes()
changes in interface ReactiveSeq<T>public <X extends java.lang.Throwable> org.reactivestreams.Subscription forEachSubscribe(java.util.function.Consumer<? super T> consumer)
ReactiveStreamsTerminalOperations
Subscription next = Spouts.of(1,2,3,4)
.forEachSubscribe(System.out::println);
next.request(2);
Thread.sleep(500);
System.out.println("First batch processed!");
next.request(2);
System.out.println("Second batch processed!");
//prints
1
2
First batch processed!
3
4
Second batch processed!
forEachSubscribe in interface ReactiveStreamsTerminalOperations<T>forEachSubscribe in interface FoldableTraversable<T>consumer - To accept incoming events from the Streampublic <X extends java.lang.Throwable> org.reactivestreams.Subscription forEachSubscribe(java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> consumerError)
ReactiveStreamsTerminalOperations
Subscription next = ReactiveSeq.of(()->1,()->2,()->throw new RuntimeException(),()->4)
.map(Supplier::get)
.forEachSubscribe(System.out::println, e->e.printStackTrace());
next.request(2);
System.out.println("First batch processed!");
next.request(2);
System.out.println("Second batch processed!");
//prints
1
2
First batch processed!
RuntimeException Stack Trace on System.err
4
Second batch processed!
forEachSubscribe in interface ReactiveStreamsTerminalOperations<T>forEachSubscribe in interface FoldableTraversable<T>consumer - To accept incoming elements from the StreamconsumerError - To accept incoming processing errors from the Streampublic <X extends java.lang.Throwable> org.reactivestreams.Subscription forEachSubscribe(java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> consumerError, java.lang.Runnable onComplete)
ReactiveStreamsTerminalOperations
Subscription next = ReactiveSeq.of(()->1,()->2,()->throw new RuntimeException(),()->4)
.map(Supplier::get)
.forEachSubscribe(System.out::println, e->e.printStackTrace(),()->System.out.println("the take!"));
next.request(2);
System.out.println("First batch processed!");
next.request(2);
System.out.println("Second batch processed!");
//prints
1
2
First batch processed!
RuntimeException Stack Trace on System.err
4
Second batch processed!
The take!
forEachSubscribe in interface ReactiveStreamsTerminalOperations<T>forEachSubscribe in interface FoldableTraversable<T>consumer - To accept incoming elements from the StreamconsumerError - To accept incoming processing errors from the StreamonComplete - To run after an onComplete eventpublic <R> R collect(java.util.function.Supplier<R> supplier,
java.util.function.BiConsumer<R,? super T> accumulator,
java.util.function.BiConsumer<R,R> combiner)
ReactiveSeqArrayList, and elements are incorporated by updating
the state of the result rather than by replacing the result. This
produces a result equivalent to:
R result = supplier.get();
for (T element : this reactiveStream)
accumulator.accept(result, element);
return result;
Like ReactiveSeq.reduce(Object, BinaryOperator), collect operations
can be parallelized without requiring additional synchronization.
This is a terminal operation.
collect in interface ReactiveSeq<T>collect in interface java.util.stream.Stream<T>supplier - a function that creates a new result container. For a
parallel execution, this function may be called
multiple times and must return a fresh value each time.accumulator - an associative,
non-interfering,
stateless
function for incorporating an additional element into a resultcombiner - an associative,
non-interfering,
stateless
function for combining two values, which must be
compatible with the accumulator functionpublic <R,A> ReactiveSeq<R> collectStream(java.util.stream.Collector<? super T,A,R> collector)
collectStream in interface ReactiveSeq<T>public <R,A> R collect(java.util.stream.Collector<? super T,A,R> collector)
ReactiveSeqCollector. A Collector
encapsulates the function used as arguments to
ReactiveSeq.collect(Supplier, BiConsumer, BiConsumer), allowing for reuse of
toX strategies and composition of collect operations such as
multiple-level grouping or partitioning.
If the reactiveStream is parallel, and the Collector
is concurrent, and
lazy the reactiveStream is unordered or the collector is
unordered,
applyHKT a concurrent reduction will be performed (see Collector for
details on concurrent reduction.)
This is a terminal operation.
When executed in parallel, multiple intermediate results may be
instantiated, populated, and merged so as to maintain isolation of
mutable data structures. Therefore, even when executed in parallel
with non-thread-safe data structures (such as ArrayList), no
additional synchronization is needed for a parallel reduction.
collect in interface CyclopsCollectable<T>collect in interface ReactiveSeq<T>collect in interface java.util.stream.Stream<T>collector - the Collector describing the reductionReactiveSeq.collect(Supplier, BiConsumer, BiConsumer),
Collectorspublic void forEachAsync(java.util.function.Consumer<? super T> action)
ReactiveSeqReactiveSeq.forEach(java.util.function.Consumer<? super T>).
For push based reactiveBuffer Stream types (created via Spouts or FutureStream)forEachAsync in interface ReactiveSeq<T>action - a
non-interfering action to perform on the elementspublic T singleUnsafe()
ReactiveSeq
//1
ReactiveSeq.of(1).singleUsafe();
//UnsupportedOperationException
ReactiveSeq.of().singleUnsafe();
//UnsupportedOperationException
ReactiveSeq.of(1,2,3).singleUnsafe();
singleUnsafe in interface Folds<T>singleUnsafe in interface ReactiveSeq<T>public Maybe<T> single()
ReactiveSeq
//Maybe[1]
ReactiveSeq.of(1).singleUnsafe();
//Maybe.none
ReactiveSeq.of().singleUnsafe();
//Maybe.none
ReactiveSeq.of(1,2,3).singleUnsafe();
public void subscribe(org.reactivestreams.Subscriber<? super T> s)
subscribe in interface Traversable<T>subscribe in interface org.reactivestreams.Publisher<T>public <R> R visit(java.util.function.Function<? super ReactiveSeq<T>,? extends R> sync, java.util.function.Function<? super ReactiveSeq<T>,? extends R> reactiveStreams, java.util.function.Function<? super ReactiveSeq<T>,? extends R> asyncNoBackPressure)
visit in interface ReactiveSeq<T>public ListT<Witness.reactiveSeq,T> groupedT(int groupSize)
TransformerTraversable
ListTSeq<Integer> transformer = ReactiveSeq.of(2,1,3,4,5,7,6,8,9,10)
.groupedT(4);
//ReactiveSeq[List[2,1,3,4],List[5,7,6,8],List[9,10]]
ListTSeq<ListX<Integer>> nested = transformer.map(i->i*2)
.sorted()
.grouped(2);
//ReactiveSeq[List[List[2,4],List[6,8]],List[List[10,14],List[12,16]],List[List[18,20]]]
groupedT in interface TransformerTraversable<T>groupSize - Size of each batch of elements to be grouped into Listspublic ListT<Witness.reactiveSeq,T> slidingT(int windowSize, int increment)
TransformerTraversable
ListTSeq<Integer> sliding = ListX.of(1,2,3,4,5,6,7)
.sliding(3,2);
//ReactiveSeq[List[1,2,3],List[3,4,5],List[5,6,7],List[7]]
slidingT in interface TransformerTraversable<T>windowSize - Size of sliding windowincrement - Increment between windowspublic ListT<Witness.reactiveSeq,T> slidingT(int windowSize)
TransformerTraversable
ListTSeq<Integer> sliding = ListX.of(1,2,3,4,5,6,7)
.sliding(3);
//ReactiveSeq[List[1,2,3],List[2,3,4],List[4,5,6],List[6,7]]
slidingT in interface TransformerTraversable<T>windowSize - Size of sliding windowpublic ListT<Witness.reactiveSeq,T> groupedUntilT(java.util.function.Predicate<? super T> predicate)
TransformerTraversable
ListTSeq<Integer> grouped = ReactiveSeq.of(1,2,3,4,5,6)
.groupedWhile(i->i%3!=0)
.toList();
//ReactiveSeq[List[1,2,3],List[4,5,6]]
groupedUntilT in interface TransformerTraversable<T>predicate - Predicate to determine batch termination pointpublic ListT<Witness.reactiveSeq,T> groupedStatefullyUntilT(java.util.function.BiPredicate<ListX<? super T>,? super T> predicate)
TransformerTraversablegroupedStatefullyUntilT in interface TransformerTraversable<T>predicate - Predicate to determine batchpublic ListT<Witness.reactiveSeq,T> groupedWhileT(java.util.function.Predicate<? super T> predicate)
TransformerTraversable
ListTSeq<Integer> grouped = ReactiveSeq.of(1,2,3,4,5,6,7,8,9,5)
.groupedUntil(i->i==5)
.toList();
//ReactiveSeq[List[1,2,3,4,5],List[6,7,8,9,5]]
groupedWhileT in interface TransformerTraversable<T>predicate - Predicate to determine batch termination point