public interface LazyFutureStream<U> extends Functor<U>, Filterable<U>, LazySimpleReactStream<U>, LazyStream<U>, ReactiveSeq<U>, LazyToQueue<U>, ConfigurableStream<U,FastFuture<U>>, FutureStreamSynchronousPublisher<U>
| Modifier and Type | Method and Description |
|---|---|
default OperationsOnFutures<U> |
actOnFutures()
LazyFutureStream operators act on the results of the previous stage by default.
|
default AnyMSeq<U> |
anyM() |
default <R> ZippingApplicativable<R> |
ap1(java.util.function.Function<? super U,? extends R> fn) |
default LazyFutureStream<U> |
append(U... values)
Append values to the end of this ReactiveSeq
|
default LazyFutureStream<U> |
appendStream(java.util.stream.Stream<U> stream)
Append Stream to this ReactiveSeq
|
default <R> ApplyingZippingApplicativeBuilder<U,R,ZippingApplicativable<R>> |
applicatives() |
default LazyFutureStream<U> |
async() |
default LazyFutureStream<U> |
boundedWaitFree(int size)
Use an Agrona ManyToOneConcurrentArrayQueue for the next operations (wait-free, mechanical sympathy).
|
default LazyFutureStream<U> |
capture(java.util.function.Consumer<java.lang.Throwable> errorHandler)
React capture
While onFail is used for disaster recovery (when it is possible to
recover) - capture is used to capture those occasions where the full
pipeline has failed and is unrecoverable.
|
default <U> LazyFutureStream<U> |
cast(java.lang.Class<? extends U> type)
Cast all elements in a stream to a given type, possibly throwing a
ClassCastException. |
default java.util.Iterator<java.util.Collection<U>> |
chunkLastReadIterator() |
default LazyFutureStream<java.util.Collection<U>> |
chunkSinceLastRead() |
default void |
closeAll()
closes all open queues.
|
default <R> R |
collect(java.util.function.Supplier<R> supplier,
java.util.function.BiConsumer<R,? super U> accumulator,
java.util.function.BiConsumer<R,R> combiner) |
default LazyFutureStream<ReactiveSeq<U>> |
combinations()
LazyFutureStream.of(1,2,3).combinations()
//LazyFutureStream[SequenceM[],SequenceM[1],SequenceM[2],SequenceM[3].SequenceM[1,2],SequenceM[1,3],SequenceM[2,3]
,SequenceM[1,2,3]]
|
default LazyFutureStream<U> |
combine(java.util.function.BiPredicate<? super U,? super U> predicate,
java.util.function.BinaryOperator<U> op)
Combine two adjacent elements in a traversable using the supplied BinaryOperator
This is a stateful grouping & reduction operation.
|
default LazyFutureStream<U> |
concat(java.util.stream.Stream<? extends U> other)
Concatenate two streams.
|
default LazyFutureStream<U> |
concat(U... other)
Concatenate two streams.
|
default LazyFutureStream<U> |
concat(U other)
Concatenate two streams.
|
default LazyFutureStream<U> |
control(java.util.function.Function<java.util.function.Supplier<U>,java.util.function.Supplier<U>> fn)
Allows clients to control the emission of data for the next phase of the
Stream.
|
default SimpleReactStream<U> |
convertToSimpleReact()
Convert between an Lazy and Eager SimpleReact Stream, can be used to take
advantages of each approach during a single Stream
Allows callers to take advantage of functionality only available in
SimpleReactStreams such as allOf
|
default java.util.List<LazyFutureStream<U>> |
copy(int times)
Copy this Stream the specified number of times
|
default long |
count() |
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
crossJoin(java.util.stream.Stream<? extends T> other)
Cross join 2 streams into one.
|
default LazyFutureStream<U> |
cycle()
Create a Stream that infinitely cycles this Stream
|
default LazyFutureStream<U> |
cycle(int times)
Create a Stream that finitely cycles this Stream, provided number of times
|
default LazyFutureStream<U> |
cycle(Monoid<U> m,
int times)
Convert to a Stream with the result of a reduction operation repeated
specified times
|
default LazyFutureStream<U> |
cycleUntil(java.util.function.Predicate<? super U> predicate)
Repeat in a Stream until specified predicate holds
|
default LazyFutureStream<U> |
cycleWhile(java.util.function.Predicate<? super U> predicate)
Repeat in a Stream while specified predicate holds
|
default LazyFutureStream<U> |
debounce(long time,
java.util.concurrent.TimeUnit unit)
Can be used to debounce (accept a single data point from a unit of time)
data.
|
default LazyFutureStream<U> |
deleteBetween(int start,
int end)
Delete elements between given indexes in a Stream
|
default LazyFutureStream<U> |
distinct() |
default <R> ReactiveSeq<U> |
distinct(java.util.function.Function<? super U,? extends R> keyExtractor) |
default LazyFutureStream<U> |
dropRight(int num) |
default LazyFutureStream<U> |
dropUntil(java.util.function.Predicate<? super U> p) |
default LazyFutureStream<U> |
dropWhile(java.util.function.Predicate<? super U> p) |
default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> |
duplicate()
Duplicate a LazyFutureStream into two equivalent Streams.
|
default org.jooq.lambda.tuple.Tuple2<LazyFutureStream<U>,LazyFutureStream<U>> |
duplicateFutureStream() |
default org.jooq.lambda.tuple.Tuple2<ReactiveSeq<U>,ReactiveSeq<U>> |
duplicateSequence()
Duplicate a Stream, buffers intermediate values, leaders may change
positions so a limit can be safely applied to the leading stream.
|
default LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,java.lang.Long>> |
elapsed()
LazyFutureStream.of(1,2,3,4,5)
.elapsed()
.forEach(System.out::println);
|
static <T> LazyFutureStream<T> |
empty()
Create a sequential synchronous stream that runs on the current thread
|
default boolean |
endsWith(java.util.stream.Stream<U> stream)
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Stream.of(5,6)));
|
default boolean |
endsWithIterable(java.lang.Iterable<U> iterable)
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Arrays.asList(5,6)));
|
default LazyFutureStream<U> |
filter(java.util.function.Predicate<? super U> p)
Keep only elements for which the supplied predicates hold
e.g.
|
default LazyFutureStream<U> |
filterNot(java.util.function.Predicate<? super U> fn)
Remove any elements for which the predicate holds (inverse operation to filter)
e.g.
|
default java.util.Optional<U> |
findAny() |
default java.util.Optional<U> |
findFirst() |
default U |
firstValue()
assertThat(ReactiveSeq.of(1,2,3,4)
.map(u->{throw new RuntimeException();})
.recover(e->"hello")
.firstValue(),equalTo("hello"));
|
default LazyFutureStream<U> |
fixedDelay(long time,
java.util.concurrent.TimeUnit unit)
Apply a fixed delay before emitting elements to the next phase of the
Stream.
|
default <R> LazyFutureStream<R> |
flatMap(java.util.function.Function<? super U,? extends java.util.stream.Stream<? extends R>> flatFn)
Allows aggregate values in a Stream to be flatten into a single Stream.
|
default <R> LazyFutureStream<R> |
flatMapAnyM(java.util.function.Function<? super U,AnyM<? extends R>> flatFn)
Allows flatMap return type to be any Monad type
|
default <R> LazyFutureStream<R> |
flatMapCompletableFuture(java.util.function.Function<? super U,java.util.concurrent.CompletableFuture<? extends R>> flatFn)
Perform a flatMap operation where the CompletableFuture type returned is flattened from the resulting Stream
If in async mode this operation is performed asyncrhonously
If in sync mode this operation is performed synchronously
|
default <R> LazyFutureStream<R> |
flatMapIterable(java.util.function.Function<? super U,? extends java.lang.Iterable<? extends R>> fn)
FlatMap where the result is a Collection, flattens the resultant
collections into the host ReactiveSeq
|
default <R> LazyFutureStream<R> |
flatMapStream(java.util.function.Function<? super U,java.util.stream.BaseStream<? extends R,?>> fn)
flatMap operation
|
default java.util.stream.DoubleStream |
flatMapToDouble(java.util.function.Function<? super U,? extends java.util.stream.DoubleStream> mapper) |
default java.util.stream.IntStream |
flatMapToInt(java.util.function.Function<? super U,? extends java.util.stream.IntStream> mapper) |
default java.util.stream.LongStream |
flatMapToLong(java.util.function.Function<? super U,? extends java.util.stream.LongStream> mapper) |
default <T1> LazyFutureStream<T1> |
flatten()
join / flatten one level of a nested hierarchy
|
default IterableFoldable<U> |
foldable() |
default <R> R |
foldRight(R identity,
java.util.function.BiFunction<? super U,? super R,? extends R> accumulator) |
default void |
forEach(java.util.function.Consumer<? super U> c) |
default <R1,R> LazyFutureStream<R> |
forEach2(java.util.function.Function<? super U,? extends java.util.stream.BaseStream<R1,?>> stream1,
java.util.function.Function<? super U,java.util.function.Function<? super R1,? extends R>> yieldingFunction)
Perform a two level nested internal iteration over this Stream and the
supplied stream
|
default <R1,R> LazyFutureStream<R> |
forEach2(java.util.function.Function<? super U,? extends java.util.stream.BaseStream<R1,?>> stream1,
java.util.function.Function<? super U,java.util.function.Function<? super R1,java.lang.Boolean>> filterFunction,
java.util.function.Function<? super U,java.util.function.Function<? super R1,? extends R>> yieldingFunction)
Perform a two level nested internal iteration over this Stream and the
supplied stream
|
default <R1,R2,R> LazyFutureStream<R> |
forEach3(java.util.function.Function<? super U,? extends java.util.stream.BaseStream<R1,?>> stream1,
java.util.function.Function<? super U,java.util.function.Function<? super R1,? extends java.util.stream.BaseStream<R2,?>>> stream2,
java.util.function.Function<? super U,java.util.function.Function<? super R1,java.util.function.Function<? super R2,? extends R>>> yieldingFunction)
Perform a three level nested internal iteration over this Stream and the
supplied streams
|
default <R1,R2,R> LazyFutureStream<R> |
forEach3(java.util.function.Function<? super U,? extends java.util.stream.BaseStream<R1,?>> stream1,
java.util.function.Function<? super U,java.util.function.Function<? super R1,? extends java.util.stream.BaseStream<R2,?>>> stream2,
java.util.function.Function<? super U,java.util.function.Function<? super R1,java.util.function.Function<? super R2,java.lang.Boolean>>> filterFunction,
java.util.function.Function<? super U,java.util.function.Function<? super R1,java.util.function.Function<? super R2,? extends R>>> yieldingFunction)
Perform a three level nested internal iteration over this Stream and the
supplied streams
|
default <X extends java.lang.Throwable> |
forEachEvent(java.util.function.Consumer<? super U> consumerElement,
java.util.function.Consumer<? super java.lang.Throwable> consumerError,
java.lang.Runnable onComplete)
Perform a forEach operation over the Stream capturing any elements and errors in the supplied consumers
when the entire Stream has been processed an onComplete event will be recieved.
|
default void |
forEachOrdered(java.util.function.Consumer<? super U> action) |
default <X extends java.lang.Throwable> |
forEachWithError(java.util.function.Consumer<? super U> consumerElement,
java.util.function.Consumer<? super java.lang.Throwable> consumerError)
Perform a forEach operation over the Stream capturing any elements and errors in the supplied consumers,
|
default <X extends java.lang.Throwable> |
forEachX(long numberOfElements,
java.util.function.Consumer<? super U> consumer)
Perform a forEach operation over the Stream, without closing it, consuming only the specified number of elements from
the Stream, at this time.
|
default <X extends java.lang.Throwable> |
forEachXEvents(long numberOfElements,
java.util.function.Consumer<? super U> 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.
|
default <X extends java.lang.Throwable> |
forEachXWithError(long numberOfElements,
java.util.function.Consumer<? super U> 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.
|
static <T> LazyFutureStream<T> |
freeThread(T... values)
Create a sequential synchronous stream that runs on a free thread (commonFreeThread executor by default, shared
across any instances created in this manner.
|
static <T> LazyFutureStream<T> |
freeThread(T value)
Create a sequential synchronous stream that runs on a free thread (commonFreeThread executor by default, shared
across any instances created in this manner.
|
default <R> LazyFutureStream<R> |
fromStream(java.util.stream.Stream<R> stream) |
default <R> LazyFutureStream<R> |
fromStreamOfFutures(java.util.stream.Stream<FastFuture<R>> stream) |
default FutureOperations<U> |
futureOperations() |
default FutureOperations<U> |
futureOperations(java.util.concurrent.Executor exec)
Access asynchronous terminal operations (each returns a Future)
|
static LazyFutureStream<java.lang.Void> |
generate()
Generate an infinite Stream of null values that runs on the current thread
|
static <T> LazyFutureStream<T> |
generate(java.util.function.Supplier<T> s)
Generate an infinite Stream of value returned from Supplier that runs on the current thread
|
static <T> LazyFutureStream<T> |
generate(T value)
Generate an infinite Stream of given value that runs on the current thread
|
LazyReact |
getSimpleReact() |
Continueable |
getSubscription() |
default <C extends java.util.Collection<U>> |
group(java.util.function.Function<java.util.function.Supplier<U>,java.util.function.Supplier<C>> fn)
Batch elements into a Stream of collections with user defined function
|
default LazyFutureStream<ListX<U>> |
grouped(int groupSize)
Group elements in a Stream
|
default <C extends java.util.Collection<? super U>> |
grouped(int size,
java.util.function.Supplier<C> supplier)
Batch the elements in this stream into Collections of specified size The
type of Collection is determined by the specified supplier
|
default LazyFutureStream<ListX<U>> |
groupedBySizeAndTime(int size,
long time,
java.util.concurrent.TimeUnit unit)
Batch elements by size into a List
|
default <C extends java.util.Collection<? super U>> |
groupedBySizeAndTime(int size,
long time,
java.util.concurrent.TimeUnit unit,
java.util.function.Supplier<C> factory)
Batch elements by size into a collection created by the supplied factory
|
default LazyFutureStream<ListX<U>> |
groupedByTime(long time,
java.util.concurrent.TimeUnit unit)
Organise elements in a Stream into a Collections based on the time period
they pass through this stage
|
default <C extends java.util.Collection<? super U>> |
groupedByTime(long time,
java.util.concurrent.TimeUnit unit,
java.util.function.Supplier<C> factory)
Organise elements in a Stream into a Collections based on the time period
they pass through this stage
|
default LazyFutureStream<ListX<U>> |
groupedStatefullyWhile(java.util.function.BiPredicate<ListX<? super U>,? super U> predicate)
Create ReactiveSeq of ListX where
each ListX is populated while the supplied bipredicate holds.
|
default LazyFutureStream<ListX<U>> |
groupedUntil(java.util.function.Predicate<? super U> predicate)
Create a ReactiveSeq batched by List, where each batch is populated until
the predicate holds
|
default <C extends java.util.Collection<? super U>> |
groupedUntil(java.util.function.Predicate<? super U> predicate,
java.util.function.Supplier<C> factory)
Create a ReactiveSeq batched by a Collection, where each batch is populated
until the predicate holds
|
default LazyFutureStream<ListX<U>> |
groupedWhile(java.util.function.Predicate<? super U> predicate)
Create a ReactiveSeq batched by List, where each batch is populated while
the predicate holds
|
default <C extends java.util.Collection<? super U>> |
groupedWhile(java.util.function.Predicate<? super U> predicate,
java.util.function.Supplier<C> factory)
Create a ReactiveSeq batched by a Collection, where each batch is populated
while the predicate holds
|
default HotStream<U> |
hotStream()
Turns this LazyFutureStream into a HotStream, a connectable Stream, being executed on a thread on the
in it's current task executor, that is producing data
|
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
innerJoin(java.util.stream.Stream<? extends T> other,
java.util.function.BiPredicate<? super U,? super T> predicate)
Inner join 2 streams into one.
|
default LazyFutureStream<U> |
insertAt(int pos,
U... values)
Insert data into a stream at given position
|
default LazyFutureStream<U> |
insertStreamAt(int pos,
java.util.stream.Stream<U> stream)
Insert a Stream into the middle of this stream at the specified position
|
default LazyFutureStream<U> |
intersperse(U value)
Returns a stream with a given value interspersed between any two values
of this stream.
|
default boolean |
isParallel() |
static <T> LazyFutureStream<T> |
iterate(T seed,
java.util.function.UnaryOperator<T> f) |
default CloseableIterator<U> |
iterator() |
default LazyFutureStream<U> |
jitter(long jitterInNanos)
Introduce a random delay between events in a stream Can be used to
prevent behaviour synchronizing within a system
|
static <T> LazyFutureStream<T> |
lazyFutureStream(java.util.concurrent.CompletableFuture<T>... values)
Create a 'free threaded' asynchronous stream that runs on a single thread (not current)
The supplier will be executed asyncrhonously, subsequent tasks will be executed synchronously unless the async() operator
is invoked.
|
static <T> LazyFutureStream<T> |
lazyFutureStream(java.util.concurrent.CompletableFuture<T> value)
Create a 'free threaded' asynchronous stream that runs on the supplied CompletableFutures executor service (unless async operator invoked
, in which it will switch to the common 'free' thread executor)
Subsequent tasks will be executed synchronously unless the async() operator is invoked.
|
static <T> LazyFutureStream<T> |
lazyFutureStream(java.util.Iterator<T> iterator)
Wrap an Iterator into a FutureStream that runs on the current thread
|
static <T> LazyFutureStream<T> |
lazyFutureStream(java.util.stream.Stream<T> stream)
Wrap a Stream into a FutureStream that runs on the current thread
|
static <T> LazyFutureStream<T> |
lazyFutureStreamFrom(java.util.stream.Stream<java.util.concurrent.CompletableFuture<T>> stream)
Create a 'free threaded' asynchronous stream that runs on the supplied CompletableFutures executor service (unless async operator invoked
, in which it will switch to the common 'free' thread executor)
Subsequent tasks will be executed synchronously unless the async() operator is invoked.
|
static <T> LazyFutureStream<T> |
lazyFutureStreamFromIterable(java.lang.Iterable<T> iterable)
Wrap an Iterable into a FutureStream that runs on the current thread
|
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
leftOuterJoin(java.util.stream.Stream<? extends T> other,
java.util.function.BiPredicate<? super U,? super T> predicate)
Left outer join 2 streams into one.
|
default LazyFutureStream<U> |
limit(long maxSize)
assertThat(ReactiveSeq.of(4,3,6,7).limit(2).toList(),equalTo(Arrays.asList(4,3)); |
default LazyFutureStream<U> |
limit(long time,
java.util.concurrent.TimeUnit unit)
Return all elements until specified time period has elapsed
|
default LazyFutureStream<U> |
limitLast(int num)
Limit results to the last x elements in a ReactiveSeq
|
default LazyFutureStream<U> |
limitUntil(java.util.function.Predicate<? super U> predicate)
Returns a stream limited to all elements for which a predicate evaluates
to false.
|
default LazyFutureStream<U> |
limitWhile(java.util.function.Predicate<? super U> predicate)
Returns a stream limited to all elements for which a predicate evaluates
to true.
|
default <R> LazyFutureStream<R> |
map(java.util.function.Function<? super U,? extends R> mapper)
Transform this functor using the supplied transformation function
|
default java.util.stream.DoubleStream |
mapToDouble(java.util.function.ToDoubleFunction<? super U> mapper) |
default java.util.stream.IntStream |
mapToInt(java.util.function.ToIntFunction<? super U> mapper) |
default java.util.stream.LongStream |
mapToLong(java.util.function.ToLongFunction<? super U> mapper) |
LazyFutureStream<U> |
maxActive(int concurrentTasks)
Configure the max active concurrent tasks.
|
default <R> LazyFutureStream<R> |
mergeLatest(LazyFutureStream<?>... streams)
Merges this stream and the supplied Streams into a single Stream where the next value
is the next returned across any of the involved Streams.
|
default LazyFutureStream<U> |
notNull()
Filter elements retaining only values which are not null
|
static <T> LazyFutureStream<T> |
of(T... values)
Create a sequential synchronous stream that runs on the current thread
|
static <T> LazyFutureStream<T> |
of(T value)
Create a sequential synchronous stream that runs on the current thread
|
default <U> LazyFutureStream<U> |
ofType(java.lang.Class<? extends U> type)
Keep only those elements in a stream that are of a given type.
|
default LazyFutureStream<U> |
onClose(java.lang.Runnable closeHandler) |
default LazyFutureStream<U> |
onEmpty(U value)
Produce this stream, or an alternative stream from the
value, in case this stream is empty. |
default LazyFutureStream<U> |
onEmptyGet(java.util.function.Supplier<? extends U> supplier)
Produce this stream, or an alternative stream from the
supplier, in case this stream is empty. |
default LazyFutureStream<U> |
onEmptySwitch(java.util.function.Supplier<? extends java.util.stream.Stream<U>> switchTo)
If this SequenceM is empty replace it with a another Stream
|
default <X extends java.lang.Throwable> |
onEmptyThrow(java.util.function.Supplier<? extends X> supplier)
Produce this stream, or an alternative stream from the
supplier, in case this stream is empty. |
default LazyFutureStream<U> |
onePer(long time,
java.util.concurrent.TimeUnit unit)
Slow emissions down, emiting one element per specified time period
|
default LazyFutureStream<U> |
onFail(java.lang.Class<? extends java.lang.Throwable> exceptionClass,
java.util.function.Function<? super SimpleReactFailedStageException,? extends U> fn)
Recover for a particular class of exceptions only.
|
default LazyFutureStream<U> |
onFail(java.util.function.Function<? super SimpleReactFailedStageException,? extends U> fn)
React onFail
Define a function that can be used to recover from exceptions during the
preceeding stage of the dataflow.
|
default LazyFutureStream<U> |
parallel() |
static <U> LazyFutureStream<U> |
parallel(U... array)
Construct an parallel LazyFutureStream from specified array, using the configured
standard parallel thread pool.
|
default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> |
partition(java.util.function.Predicate<? super U> predicate)
Partition a stream in two given a predicate.
|
default org.jooq.lambda.tuple.Tuple2<LazyFutureStream<U>,LazyFutureStream<U>> |
partitionFutureStream(java.util.function.Predicate<? super U> predicate)
Partition an LazyFutureStream into two LazyFutureStreams given a
predicate.
|
default org.jooq.lambda.tuple.Tuple2<ReactiveSeq<U>,ReactiveSeq<U>> |
partitionSequence(java.util.function.Predicate<U> splitter)
Partition a Stream into two one a per element basis, based on predicate's
boolean value
|
default <R> LazyFutureStream<R> |
patternMatch(java.util.function.Function<Matchable.CheckValue1<U,R>,Matchable.CheckValue1<U,R>> case1,
java.util.function.Supplier<? extends R> otherwise)
Transform the elements of this Stream with a Pattern Matching case and default value
|
default LazyFutureStream<U> |
peek(java.util.function.Consumer<? super U> consumer)
Peek at the current value of this Functor, without transforming it
|
default LazyFutureStream<U> |
peekSync(java.util.function.Consumer<? super U> consumer)
Synchronous peek operator
|
default LazyFutureStream<ReactiveSeq<U>> |
permutations()
Generate the permutations based on values in the LazyFutureStream
Makes use of Streamable to store intermediate stages in a collection
|
default LazyFutureStream<U> |
prepend(U... values)
Prepend given values to the start of the Stream
|
default LazyFutureStream<U> |
prependStream(java.util.stream.Stream<U> stream)
Prepend Stream to this ReactiveSeq
|
default org.jooq.lambda.tuple.Tuple4<ReactiveSeq<U>,ReactiveSeq<U>,ReactiveSeq<U>,ReactiveSeq<U>> |
quadruplicate()
Makes four copies of a Stream Buffers intermediate values, leaders may
change positions so a limit can be safely applied to the leading stream.
|
static <T> LazyFutureStream<T> |
react(java.util.function.Supplier<T>... values)
Create a 'free threaded' asynchronous stream that runs on a single thread (not current)
The supplier will be executed asyncrhonously, subsequent tasks will be executed synchronously unless the async() operator is invoked.
|
static <T> LazyFutureStream<T> |
react(java.util.function.Supplier<T> value)
Create a 'free threaded' asynchronous stream that runs on a single thread (not current)
The supplier will be executed asyncrhonously, subsequent tasks will be executed synchronously unless the async() operator
is invoked.
|
default <EX extends java.lang.Throwable> |
recover(java.lang.Class<EX> exceptionClass,
java.util.function.Function<EX,? extends U> fn)
Recover from a particular exception type
|
default LazyFutureStream<U> |
recover(java.util.function.Function<java.lang.Throwable,? extends U> fn)
Recover from an exception with an alternative value
|
default java.util.Optional<U> |
reduce(java.util.function.BinaryOperator<U> accumulator) |
default <T> T |
reduce(T identity,
java.util.function.BiFunction<T,? super U,T> accumulator) |
default <T> T |
reduce(T identity,
java.util.function.BiFunction<T,? super U,T> accumulator,
java.util.function.BinaryOperator<T> combiner) |
default U |
reduce(U identity,
java.util.function.BinaryOperator<U> accumulator) |
default LazyFutureStream<U> |
remove(U t)
Remove all occurances of the specified element from the SequenceM
|
default <R> LazyFutureStream<R> |
retry(java.util.function.Function<? super U,? extends R> fn)
Will execute this phase on the RetryExecutor (default or user supplied).
|
default LazyFutureStream<U> |
reverse()
Reverse a stream.
|
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
rightOuterJoin(java.util.stream.Stream<? extends T> other,
java.util.function.BiPredicate<? super U,? super T> predicate)
Right outer join 2 streams into one.
|
default LazyFutureStream<U> |
scanLeft(Monoid<U> monoid)
Scan left using supplied Monoid
|
default <T> LazyFutureStream<T> |
scanLeft(T seed,
java.util.function.BiFunction<? super T,? super U,? extends T> function)
Scan a stream to the left.
|
default LazyFutureStream<U> |
scanRight(Monoid<U> monoid)
Scan right
|
default <R> LazyFutureStream<R> |
scanRight(R seed,
java.util.function.BiFunction<? super U,? super R,? extends R> function)
Scan a stream to the right.
|
default LazyFutureStream<U> |
self(java.util.function.Consumer<LazyFutureStream<U>> consumer)
Give a consumer access to this Stream
|
default LazyFutureStream<U> |
sequential() |
default <K> java.util.Map<K,LazyFutureStream<U>> |
shard(java.util.Map<K,Queue<U>> shards,
java.util.function.Function<? super U,? extends K> sharder)
Break a stream into multiple Streams based of some characteristic of the
elements of the Stream
e.g.
|
default LazyFutureStream<U> |
shuffle()
Shuffle a stream
// e.g.
|
default LazyFutureStream<U> |
shuffle(java.util.Random random)
Shuffle a stream using specified source of randomness
// e.g.
|
default LazyFutureStream<U> |
skip(long n)
assertThat(ReactiveSeq.of(4,3,6,7).skip(2).toList(),equalTo(Arrays.asList(6,7))); |
default LazyFutureStream<U> |
skip(long time,
java.util.concurrent.TimeUnit unit)
Skip all elements until specified time period has passed
|
default LazyFutureStream<U> |
skipLast(int num)
assertThat(ReactiveSeq.of(1,2,3,4,5) .skipLast(2)
.collect(Collectors.toList()),equalTo(Arrays.asList(1,2,3)));
|
default LazyFutureStream<U> |
skipUntil(java.util.function.Predicate<? super U> predicate)
Returns a stream with all elements skipped for which a predicate
evaluates to false.
|
default LazyFutureStream<U> |
skipWhile(java.util.function.Predicate<? super U> predicate)
Returns a stream with all elements skipped for which a predicate
evaluates to true.
|
default LazyFutureStream<U> |
slice(long from,
long to) |
default LazyFutureStream<ListX<U>> |
sliding(int size)
Create a sliding view over this Stream
|
default LazyFutureStream<ListX<U>> |
sliding(int size,
int increment)
Create a sliding view over this Stream
|
default LazyFutureStream<U> |
sorted()
assertThat(ReactiveSeq.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7))); |
default LazyFutureStream<U> |
sorted(java.util.Comparator<? super U> comparator)
assertThat(ReactiveSeq.of(4,3,6,7).sorted((a,b) -> b-a).toList(),equalTo(Arrays.asList(7,6,4,3)));
|
default <R extends java.lang.Comparable<? super R>> |
sorted(java.util.function.Function<? super U,? extends R> function) |
default org.jooq.lambda.tuple.Tuple2<ReactiveSeq<U>,ReactiveSeq<U>> |
splitAt(int where)
Split at supplied location
|
default org.jooq.lambda.tuple.Tuple2<ReactiveSeq<U>,ReactiveSeq<U>> |
splitBy(java.util.function.Predicate<U> splitter)
Split stream at point where predicate no longer holds
|
default java.util.Spliterator<U> |
spliterator() |
default org.jooq.lambda.tuple.Tuple2<java.util.Optional<U>,ReactiveSeq<U>> |
splitSequenceAtHead()
Split a Stream at it's head (similar to headAndTail)
|
default boolean |
startsWith(java.util.stream.Stream<U> iterator)
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Stream.of(1,2,3))) |
default boolean |
startsWithIterable(java.lang.Iterable<U> iterable)
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Arrays.asList(1,2,3)));
|
default ReactiveSeq<U> |
stream()
Convert this ReactiveSeq into a Stream
|
default void |
subscribe(org.reactivestreams.Subscriber<? super U> s) |
default LazyFutureStream<U> |
subStream(int start,
int end)
Return a Stream with elements before the provided start index removed, and elements after the provided
end index removed
|
default <R> LazyFutureStream<R> |
switchOnNextValue(java.util.stream.Stream<LazyFutureStream> streams)
Merges this stream and the supplied Streams into a single Stream where the next value
is the next returned across any of the involved Streams.
|
default LazyFutureStream<U> |
sync() |
default LazyFutureStream<U> |
takeRight(int num) |
default LazyFutureStream<U> |
takeUntil(java.util.function.Predicate<? super U> p) |
default LazyFutureStream<U> |
takeWhile(java.util.function.Predicate<? super U> p) |
default <R> LazyFutureStream<R> |
then(java.util.function.Function<? super U,? extends R> fn)
React then
Unlike 'with' this method is fluent, and returns another Stage Builder
that can represent the next stage in the dataflow.
|
default <R> LazyFutureStream<R> |
then(java.util.function.Function<? super U,? extends R> fn,
java.util.concurrent.Executor service) |
default <R> LazyFutureStream<R> |
thenSync(java.util.function.Function<? super U,? extends R> fn) |
default java.lang.Object[] |
toArray() |
default <A> A[] |
toArray(java.util.function.IntFunction<A[]> generator) |
default <C extends java.util.Collection<U>> |
toCollection(java.util.function.Supplier<C> collectionFactory) |
default java.util.concurrent.CompletableFuture<ListX<U>> |
toCompletableFuture()
CompletableFuture<List<String>> cf = anyM("hello","world")
.asSequence()
.unwrapCompletableFuture();
assertThat(cf.join(),equalTo(Arrays.asList("hello","world")));
|
default CollectionX<U> |
toConcurrentLazyCollection()
Lazily converts this ReactiveSeq into a Collection.
|
default Streamable<U> |
toConcurrentLazyStreamable()
{
@code
Streamable<Integer> repeat = ReactiveSeq.of(1, 2, 3, 4, 5, 6).map(i -> i + 2).toConcurrentLazyStreamable();
assertThat(repeat.sequenceM().toList(), equalTo(Arrays.asList(2, 4, 6, 8, 10, 12)));
assertThat(repeat.sequenceM().toList(), equalTo(Arrays.asList(2, 4, 6, 8, 10, 12)));
}
|
default CollectionX<U> |
toLazyCollection()
Lazily converts this ReactiveSeq into a Collection.
|
default java.util.List<U> |
toList() |
default java.util.Optional<ListX<U>> |
toOptional()
Optional<List<String>> stream = anyM("hello","world")
.asSequence()
.unwrapOptional();
assertThat(stream.get(),equalTo(Arrays.asList("hello","world")));
|
default Queue<U> |
toQueue()
Convert the current Stream to a simple-react Queue
|
default java.util.Set<U> |
toSet() |
default <U> java.util.stream.Stream<U> |
toStream()
Convert this ReactiveSeq into a Stream
|
default Streamable<U> |
toStreamable()
Streamable<Integer> repeat = ReactiveSeq.of(1,2,3,4,5,6)
.map(i->i*2)
.toStreamable();
repeat.sequenceM().toList(); //Arrays.asList(2,4,6,8,10,12));
repeat.sequenceM().toList() //Arrays.asList(2,4,6,8,10,12));
|
default <R> LazyFutureStream<R> |
trampoline(java.util.function.Function<? super U,? extends Trampoline<? extends R>> mapper)
Performs a map operation that can call a recursive method without running out of stack space
|
default org.jooq.lambda.tuple.Tuple3<ReactiveSeq<U>,ReactiveSeq<U>,ReactiveSeq<U>> |
triplicate()
Triplicates a Stream Buffers intermediate values, leaders may change
positions so a limit can be safely applied to the leading stream.
|
default LazyFutureStream<U> |
unboundedWaitFree()
This is the default setting, internal queues are backed by a ConcurrentLinkedQueue
This operator will return the next stage to using this Queue type if it has been changed
|
default LazyFutureStream<U> |
unordered() |
default <R> R |
unwrap()
START SEQUENCEM
|
LazyFutureStream<U> |
withAsync(boolean async) |
<R> LazyFutureStream<R> |
withLastActive(LazyStreamWrapper<R> streamWrapper) |
LazyFutureStream<U> |
withLazyCollector(java.util.function.Supplier<LazyResultConsumer<U>> lazy) |
LazyFutureStream<U> |
withQueueFactory(QueueFactory<U> queue) |
LazyFutureStream<U> |
withRetrier(com.nurkiewicz.asyncretry.RetryExecutor retry) |
LazyFutureStream<U> |
withSubscription(Continueable sub) |
LazyFutureStream<U> |
withTaskExecutor(java.util.concurrent.Executor e) |
default LazyFutureStream<U> |
xPer(int x,
long time,
java.util.concurrent.TimeUnit unit)
Allows x (specified number of) emissions with a time period before
stopping emmissions until specified time has elapsed since last emission
|
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
zip(java.lang.Iterable<? extends T> other) |
default <T,R> LazyFutureStream<R> |
zip(java.lang.Iterable<? extends T> other,
java.util.function.BiFunction<? super U,? super T,? extends R> zipper) |
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
zip(org.jooq.lambda.Seq<? extends T> other)
Zip two streams into one.
|
default <T,R> LazyFutureStream<R> |
zip(org.jooq.lambda.Seq<? extends T> other,
java.util.function.BiFunction<? super U,? super T,? extends R> zipper)
Zip two streams into one using a
BiFunction to produce resulting
values. |
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
zip(java.util.stream.Stream<? extends T> other)
Zip 2 streams into one
|
default <T,R> LazyFutureStream<R> |
zip(java.util.stream.Stream<? extends T> other,
java.util.function.BiFunction<? super U,? super T,? extends R> zipper) |
default <S,R> LazyFutureStream<org.jooq.lambda.tuple.Tuple3<U,S,R>> |
zip3(java.util.stream.Stream<? extends S> second,
java.util.stream.Stream<? extends R> third)
zip 3 Streams into one
|
default <T2,T3,T4> LazyFutureStream<org.jooq.lambda.tuple.Tuple4<U,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
|
default <S,R> LazyFutureStream<R> |
zipStream(java.util.stream.BaseStream<? extends S,? extends java.util.stream.BaseStream<? extends S,?>> second,
java.util.function.BiFunction<? super U,? super S,? extends R> zipper)
Zip this Monad with a Stream
|
default LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,java.lang.Long>> |
zipWithIndex()
Zip a Stream with a corresponding Stream of indexes.
|
assureSimpleReactException, copySimpleReactStream, filterSync, flatMapToCompletableFuture, flatMapToCompletableFutureSync, getLastActive, handleExceptions, streamCompletableFutures, withErrorHandlergetErrorHandler, getRetrier, getTaskExecutor, isAsyncgetQueueFactory, getTaskExecutor, isAsync, simpleReactStream, simpleReactStream, simpleReactStream, simpleReactStream, simpleReactStreamFrom, simpleReactStreamFromIterableblock, block, getErrorHandlergetErrorHandler, getLastActive, getLazyCollector, getMaxActive, run, run, runContinuation, runOnCurrent, runThreadallMatch, anyMatch, append, avg, avg, avgDouble, avgInt, avgLong, collect, collectable, combinations, count, countDistinct, countDistinct, countDistinctBy, countDistinctBy, crossJoin, crossJoin, elementAt, foldRight, foldRight, foldRightMapToType, fromDoubleStream, fromIntStream, fromIterable, fromIterator, fromList, fromLongStream, fromPublisher, fromStream, get, groupBy, grouped, grouped, headAndTail, hotStream, innerJoin, innerJoin, innerJoin, join, join, join, leftOuterJoin, leftOuterJoin, leftOuterJoin, limitUntilClosed, mapReduce, mapReduce, max, max, max, max, maxBy, maxBy, median, median, medianBy, medianBy, min, min, min, min, minBy, minBy, mode, noneMatch, pausableHotStream, percentile, percentile, percentileBy, percentileBy, prepend, primedHotStream, primedPausableHotStream, print, print, printErr, printOut, range, rangeLong, reduce, reduce, reduce, retry, reversedListOf, reversedOf, rightOuterJoin, rightOuterJoin, schedule, scheduleFixedDelay, scheduleFixedRate, single, single, singleOptional, size, skipUntilClosed, subscriber, sum, sum, sumDouble, sumInt, sumLong, timestamp, toList, toMap, toSet, toString, toString, unfold, unit, unitIterator, unzip, unzip3, unzip4, xMatchremoveAll, removeAll, removeAll, removeAll, retainAll, retainAll, retainAll, retainAllgroupedStatefullyWhileT, groupedT, groupedUntilT, groupedWhileT, slidingT, slidingTvisitbitAnd, bitAnd, bitAndInt, bitAndLong, bitOr, bitOr, bitOrInt, bitOrLong, commonPrefix, commonSuffix, maxAll, maxAll, maxAll, maxAll, maxAllBy, maxAllBy, minAll, minAll, minAll, minAll, minAllBy, minAllBy, modeAll, modeAllBy, modeBy, toMapwindow, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, windowappend, append, append, append, cast, close, concat, concat, concat, concat, concat, concat, concat, contains, containsAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, containsAny, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, cycle, cycle, cycle, cycle, cycle, cycle, cycle, drop, duplicate, findFirst, findSingle, foldLeft, foldLeft, foldLeft, foldLeft, foldRight, foldRight, foldRight, format, groupBy, groupBy, groupBy, groupBy, groupBy, grouped, grouped, grouped, grouped, grouped, grouped, intersperse, isEmpty, isNotEmpty, join, join, join, join, join, limit, limitUntil, limitUntilClosed, limitWhile, limitWhileClosed, limitWhileClosed, ofType, partition, prepend, prepend, prepend, prepend, range, range, range, range, range, range, range, range, range, range, range, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, reverse, reverse, reverse, scanLeft, scanLeft, scanLeft, scanRight, scanRight, scanRight, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, shuffle, shuffle, shuffle, shuffle, shuffle, shuffle, skip, skipUntil, skipUntilClosed, skipWhile, skipWhileClosed, skipWhileClosed, slice, sliding, sorted, splitAt, splitAt, splitAtHead, splitAtHead, take, toCollection, toList, toMap, toMap, toSet, toString, toString, transform, unzip, unzip, unzip, unzip, unzip, unzip, unzip, unzip, unzip, unzip, unzip, unzip, window, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipWithIndex, zipWithIndex, zipWithIndexap2, ap3, ap4, ap5flatMapPublisher, flatMapPublisher, flatMapPublisher, mergePublisher, mergePublisherlazyOperations, traversableseq, toDequeX, toEvalAlways, toEvalLater, toEvalNow, toFutureStream, toFutureStream, toFutureW, toIor, toIorSecondary, toListX, toMapX, toMaybe, toPBagX, toPMapX, toPOrderedSetX, toPQueueX, toPSetX, toPStackX, toPVectorX, toQueueX, toSetX, toSimpleReact, toSimpleReact, toSortedSetX, toTry, toValue, toValueMap, toValueSet, toXor, toXorSecondaryadd, addToQueue, getPopulator, returnPopulator, toQueue, toQueuegetQueueFactorycancel, forwardErrors, getLastActive, subscribeSyncdefault LazyFutureStream<U> filterNot(java.util.function.Predicate<? super U> fn)
Filterable
of(1,2,3).filter(i->i>2);
//[1,2]
filterNot in interface Filterable<U>filterNot in interface JoolManipulation<U>fn - to filter elements by, retaining matchesdefault LazyFutureStream<U> notNull()
Filterable
of(1,2,null,4).nonNull();
//[1,2,4]
notNull in interface Filterable<U>notNull in interface JoolManipulation<U>default <R> LazyFutureStream<R> trampoline(java.util.function.Function<? super U,? extends Trampoline<? extends R>> mapper)
Functor
ReactiveSeq.of(10,20,30,40)
.trampoline(i-> fibonacci(i))
.forEach(System.out::println);
Trampoline<Long> fibonacci(int i){
return fibonacci(i,1,0);
}
Trampoline<Long> fibonacci(int n, long a, long b) {
return n == 0 ? Trampoline.done(b) : Trampoline.more( ()->fibonacci(n-1, a+b, a));
}
55
6765
832040
102334155
ReactiveSeq.of(10_000,200_000,3_000_000,40_000_000)
.trampoline(i-> fibonacci(i))
.forEach(System.out::println);
completes successfully
trampoline in interface Functor<U>trampoline in interface ReactiveSeq<U>default <R> R foldRight(R identity,
java.util.function.BiFunction<? super U,? super R,? extends R> accumulator)
default <R> ApplyingZippingApplicativeBuilder<U,R,ZippingApplicativable<R>> applicatives()
applicatives in interface ReactiveSeq<U>applicatives in interface ZippingApplicativable<U>default <R> ZippingApplicativable<R> ap1(java.util.function.Function<? super U,? extends R> fn)
ap1 in interface ReactiveSeq<U>ap1 in interface ZippingApplicativable<U>default LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,java.lang.Long>> elapsed()
LazyFutureStream.of(1,2,3,4,5)
.elapsed()
.forEach(System.out::println);
elapsed in interface ReactiveSeq<U>default LazyFutureStream<U> combine(java.util.function.BiPredicate<? super U,? super U> predicate, java.util.function.BinaryOperator<U> op)
Traversable
ReactiveSeq.of(1,1,2,3)
.combine((a, b)->a.equals(b),Semigroups.intSum)
.toListX()
//ListX(3,4)
combine in interface ReactiveSeq<U>combine in interface Traversable<U>predicate - Test to see if two neighbours should be joinedop - Reducer to combine neighboursdefault LazyFutureStream<U> onEmptySwitch(java.util.function.Supplier<? extends java.util.stream.Stream<U>> switchTo)
assertThat(LazyFutureStream.of(4,5,6)
.onEmptySwitch(()->ReactiveSeq.of(1,2,3))
.toList(),
equalTo(Arrays.asList(4,5,6)));
onEmptySwitch in interface ReactiveSeq<U>switchTo - Supplier that will generate the alternative Streamdefault <R1,R2,R> LazyFutureStream<R> forEach3(java.util.function.Function<? super U,? extends java.util.stream.BaseStream<R1,?>> stream1, java.util.function.Function<? super U,java.util.function.Function<? super R1,? extends java.util.stream.BaseStream<R2,?>>> stream2, java.util.function.Function<? super U,java.util.function.Function<? super R1,java.util.function.Function<? super R2,? extends R>>> yieldingFunction)
LazyFutureStream.of(1,2)
.forEach2(a->IntStream.range(10,13),
.forEach2(a->b->Stream.of(""+(a+b),"hello world"),
a->b->c->c+":"a+":"+b);
//LFS[11:1:2,hello world:1:2,14:1:4,hello world:1:4,12:1:2,hello world:1:2,15:1:5,hello world:1:5]
forEach3 in interface ReactiveSeq<U>stream1 - Nested Stream to iterate overstream2 - Nested Stream to iterate overyieldingFunction - Function with pointers to the current element from both
Streams that generates the new elementsdefault <R1,R2,R> LazyFutureStream<R> forEach3(java.util.function.Function<? super U,? extends java.util.stream.BaseStream<R1,?>> stream1, java.util.function.Function<? super U,java.util.function.Function<? super R1,? extends java.util.stream.BaseStream<R2,?>>> stream2, java.util.function.Function<? super U,java.util.function.Function<? super R1,java.util.function.Function<? super R2,java.lang.Boolean>>> filterFunction, java.util.function.Function<? super U,java.util.function.Function<? super R1,java.util.function.Function<? super R2,? extends R>>> yieldingFunction)
LazyFutureStream.of(1,2,3)
.forEach3(a->IntStream.range(10,13),
a->b->Stream.of(""+(a+b),"hello world"),
a->b->c-> c!=3,
a->b->c->c+":"a+":"+b);
//LazyFutureStream[11:1:2,hello world:1:2,14:1:4,hello world:1:4,12:1:2,hello world:1:2,15:1:5,hello world:1:5]
forEach3 in interface ReactiveSeq<U>stream1 - Nested Stream to iterate overstream2 - Nested Stream to iterate overfilterFunction - Filter to apply over elements before passing non-filtered
values to the yielding functionyieldingFunction - Function with pointers to the current element from both
Streams that generates the new elementsdefault <R1,R> LazyFutureStream<R> forEach2(java.util.function.Function<? super U,? extends java.util.stream.BaseStream<R1,?>> stream1, java.util.function.Function<? super U,java.util.function.Function<? super R1,? extends R>> yieldingFunction)
LazyFutureStream.of(1,2,3)
.forEach2(a->IntStream.range(10,13),
a->b->a+b);
//LFS[11,14,12,15,13,16]
forEach2 in interface ReactiveSeq<U>stream1 - Nested Stream to iterate overyieldingFunction - Function with pointers to the current element from both
Streams that generates the new elementsdefault <R1,R> LazyFutureStream<R> forEach2(java.util.function.Function<? super U,? extends java.util.stream.BaseStream<R1,?>> stream1, java.util.function.Function<? super U,java.util.function.Function<? super R1,java.lang.Boolean>> filterFunction, java.util.function.Function<? super U,java.util.function.Function<? super R1,? extends R>> yieldingFunction)
LazyFutureStream.of(1,2,3)
.forEach2(a->IntStream.range(10,13),
a->b-> a<3 && b>10,
a->b->a+b);
//LFS[14,15]
forEach2 in interface ReactiveSeq<U>stream1 - Nested Stream to iterate overfilterFunction - Filter to apply over elements before passing non-filtered
values to the yielding functionyieldingFunction - Function with pointers to the current element from both
Streams that generates the new elementsdefault <R> LazyFutureStream<R> patternMatch(java.util.function.Function<Matchable.CheckValue1<U,R>,Matchable.CheckValue1<U,R>> case1, java.util.function.Supplier<? extends R> otherwise)
List<String> result = LazyFutureStream.of(1,2,3,4)
.patternMatch(
c->c.hasValuesWhere( (Integer i)->i%2==0 ).then(i->"even")
)
// LazyFutureStream["odd","even","odd","even"]
patternMatch in interface Functor<U>patternMatch in interface ReactiveSeq<U>defaultValue - Value if supplied case doesn't matchcase1 - Function to generate a case (or chain of cases as a single case)default LazyFutureStream<U> remove(U t)
LazyFutureStream.of(1,2,3,4,5,1,2,3).remove(1)
//LazyFutureStream[2,3,4,5,2,3]
remove in interface ReactiveSeq<U>remove in interface org.jooq.lambda.Seq<U>t - element to removedefault LazyFutureStream<U> subStream(int start, int end)
LazyFutureStream.of(1,2,3,4,5,6).subStream(1,3);
//LazyFutureStream[2,3]
subStream in interface ReactiveSeq<U>start - index inclusiveend - index exclusivedefault LazyFutureStream<ReactiveSeq<U>> permutations()
permutations in interface ExtendedTraversable<U>permutations in interface ReactiveSeq<U>default LazyFutureStream<ReactiveSeq<U>> combinations()
LazyFutureStream.of(1,2,3).combinations()
//LazyFutureStream[SequenceM[],SequenceM[1],SequenceM[2],SequenceM[3].SequenceM[1,2],SequenceM[1,3],SequenceM[2,3]
,SequenceM[1,2,3]]
combinations in interface ExtendedTraversable<U>combinations in interface ReactiveSeq<U>default OperationsOnFutures<U> actOnFutures()
new LazyReact().react(()->slow(),()->fast())
.zipWithIndex();
//[fast,0l],[slow,1l]
The first result will be fast and will have index 0 (the result index)
Operating on futures
new LazyReact().react(()->slow(),()->fast())
.actOnFutures()
.zipWithIndex();
//[fast,1l],[slow,0l]
The first result will still be fast, but the index will now be the start index 1default CloseableIterator<U> iterator()
iterator in interface BaseSimpleReactStream<U>iterator in interface java.util.stream.BaseStream<U,java.util.stream.Stream<U>>iterator in interface java.lang.Iterable<U>iterator in interface LazyStream<U>Continueable getSubscription()
getSubscription in interface BaseSimpleReactStream<U>getSubscription in interface LazySimpleReactStream<U><R> LazyFutureStream<R> withLastActive(LazyStreamWrapper<R> streamWrapper)
withLastActive in interface LazySimpleReactStream<U>LazyReact getSimpleReact()
getSimpleReact in interface BaseSimpleReactStream<U>getSimpleReact in interface ConfigurableStream<U,FastFuture<U>>getSimpleReact in interface LazySimpleReactStream<U>default void subscribe(org.reactivestreams.Subscriber<? super U> s)
subscribe in interface FutureStreamSynchronousPublisher<U>subscribe in interface org.reactivestreams.Publisher<U>subscribe in interface Traversable<U>default java.util.Iterator<java.util.Collection<U>> chunkLastReadIterator()
default LazyFutureStream<java.util.Collection<U>> chunkSinceLastRead()
default long count()
count in interface org.jooq.lambda.Collectable<U>count in interface CyclopsCollectable<U>count in interface ReactiveSeq<U>count in interface org.jooq.lambda.Seq<U>count in interface java.util.stream.Stream<U>LazyFutureStream<U> withTaskExecutor(java.util.concurrent.Executor e)
withTaskExecutor in interface ConfigurableStream<U,FastFuture<U>>withTaskExecutor in interface LazySimpleReactStream<U>LazyFutureStream<U> withRetrier(com.nurkiewicz.asyncretry.RetryExecutor retry)
withRetrier in interface BaseSimpleReactStream<U>withRetrier in interface ConfigurableStream<U,FastFuture<U>>withRetrier in interface LazySimpleReactStream<U>LazyFutureStream<U> withLazyCollector(java.util.function.Supplier<LazyResultConsumer<U>> lazy)
LazyFutureStream<U> withQueueFactory(QueueFactory<U> queue)
withQueueFactory in interface BaseSimpleReactStream<U>withQueueFactory in interface ConfigurableStream<U,FastFuture<U>>withQueueFactory in interface LazySimpleReactStream<U>LazyFutureStream<U> withSubscription(Continueable sub)
withSubscription in interface BaseSimpleReactStream<U>withSubscription in interface ConfigurableStream<U,FastFuture<U>>withSubscription in interface LazySimpleReactStream<U>LazyFutureStream<U> withAsync(boolean async)
withAsync in interface ConfigurableStream<U,FastFuture<U>>withAsync in interface LazySimpleReactStream<U>default void forEach(java.util.function.Consumer<? super U> c)
default Queue<U> toQueue()
LazyToQueuetoQueue in interface BaseSimpleReactStream<U>toQueue in interface FutureStreamSynchronousPublisher<U>toQueue in interface LazyToQueue<U>toQueue in interface ToQueue<U>default <T> T reduce(T identity,
java.util.function.BiFunction<T,? super U,T> accumulator)
default U reduce(U identity, java.util.function.BinaryOperator<U> accumulator)
reduce in interface Foldable<U>reduce in interface LazyStream<U>reduce in interface ReactiveSeq<U>reduce in interface java.util.stream.Stream<U>default <T> T reduce(T identity,
java.util.function.BiFunction<T,? super U,T> accumulator,
java.util.function.BinaryOperator<T> combiner)
reduce in interface Foldable<U>reduce in interface LazyStream<U>reduce in interface ReactiveSeq<U>reduce in interface java.util.stream.Stream<U>default java.util.Optional<U> reduce(java.util.function.BinaryOperator<U> accumulator)
reduce in interface Foldable<U>reduce in interface LazyStream<U>reduce in interface ReactiveSeq<U>reduce in interface java.util.stream.Stream<U>default <R> R collect(java.util.function.Supplier<R> supplier,
java.util.function.BiConsumer<R,? super U> accumulator,
java.util.function.BiConsumer<R,R> combiner)
collect in interface LazyStream<U>collect in interface java.util.stream.Stream<U>default LazyFutureStream<U> sync()
sync in interface BaseSimpleReactStream<U>default LazyFutureStream<U> async()
async in interface BaseSimpleReactStream<U>default LazyFutureStream<U> unboundedWaitFree()
default LazyFutureStream<U> boundedWaitFree(int size)
LazyFutureStream.of(col)
.boundedWaitFree(110)
.flatMap(Collection::stream)
.toList();
size - Buffer sizeLazyFutureStream<U> maxActive(int concurrentTasks)
List<String> data = new LazyReact().react(urlFile)
.maxActive(100)
.flatMap(this::loadUrls)
.map(this::callUrls)
.block();
concurrentTasks - Maximum number of active task chainsdefault <R> LazyFutureStream<R> thenSync(java.util.function.Function<? super U,? extends R> fn)
thenSync in interface BaseSimpleReactStream<U>thenSync in interface LazySimpleReactStream<U>thenSync in interface LazyToQueue<U>default LazyFutureStream<U> peekSync(java.util.function.Consumer<? super U> consumer)
LazySimpleReactStreampeekSync in interface BaseSimpleReactStream<U>peekSync in interface LazySimpleReactStream<U>peekSync in interface LazyToQueue<U>consumer - Peek consumerdefault void closeAll()
default HotStream<U> hotStream()
HotStream<Integer> ints = new LazyReact().range(0,Integer.MAX_VALUE)
.hotStream()
ints.connect().forEach(System.out::println);
//print out all the ints
//multiple consumers are possible, so other Streams can connect on different Threads
default java.util.Optional<U> findFirst()
findFirst in interface Foldable<U>findFirst in interface ReactiveSeq<U>findFirst in interface java.util.stream.Stream<U>
ReactiveSeq.of(1,2,3,4,5).filter(it -> it <3).findFirst().get();
//3
(deterministic)default SimpleReactStream<U> convertToSimpleReact()
LazyReact.parallelCommonBuilder()
.react(()->slow(),()->1,()->2)
.peek(System.out::println)
.convertToSimpleReact()
.allOf(list->list)
.block()
default <R> LazyFutureStream<R> map(java.util.function.Function<? super U,? extends R> mapper)
Functor
of(1,2,3).map(i->i*2)
//[2,4,6]
map in interface FilterableFunctor<U>map in interface Functor<U>map in interface IterableFunctor<U>map in interface ReactiveSeq<U>map in interface org.jooq.lambda.Seq<U>map in interface java.util.stream.Stream<U>mapper - Transformation functiondefault <K> java.util.Map<K,LazyFutureStream<U>> shard(java.util.Map<K,Queue<U>> shards, java.util.function.Function<? super U,? extends K> sharder)
LazyFutureStream.of(10,20,25,30,41,43).shard(ImmutableMap.of("even",new
Queue(),"odd",new Queue(),element-> element%2==0? "even" : "odd");
results in 2 Streams "even": 10,20,30 "odd" : 25,41,43shards - Map of Queue's keyed by shard identifiersharder - Function to split split incoming elements into shardsdefault LazyFutureStream<U> debounce(long time, java.util.concurrent.TimeUnit unit)
LazyFutureStream.of(1,2,3,4,5,6)
.debounce(1000,TimeUnit.SECONDS).toList();
// [1]
debounce in interface ReactiveSeq<U>time - Time from which to accept only one elementunit - Time unit for specified timedefault LazyFutureStream<U> control(java.util.function.Function<java.util.function.Supplier<U>,java.util.function.Supplier<U>> fn)
fn - Function takes a supplier, which can be used repeatedly to get
the next value from the Stream. If there are no more values, a
ClosedQueueException will be thrown. This function should
return a Supplier which returns the desired result for the
next element (or just the next element).default <C extends java.util.Collection<U>> LazyFutureStream<C> group(java.util.function.Function<java.util.function.Supplier<U>,java.util.function.Supplier<C>> fn)
fn - Function takes a supplier, which can be used repeatedly to get
the next value from the Stream. If there are no more values, a
ClosedQueueException will be thrown. This function should
return a Supplier which creates a collection of the batched
valuesdefault LazyFutureStream<ListX<U>> groupedBySizeAndTime(int size, long time, java.util.concurrent.TimeUnit unit)
ReactiveSeq
ReactiveSeq.of(1,2,3,4,5,6)
.batchBySizeAndTime(3,10,TimeUnit.SECONDS)
.toList();
//[[1,2,3],[4,5,6]]
groupedBySizeAndTime in interface ReactiveSeq<U>size - Max size of a batchtime - (Max) time period to build a single batch inunit - time unit for batchdefault <C extends java.util.Collection<? super U>> LazyFutureStream<C> grouped(int size, java.util.function.Supplier<C> supplier)
LazyFutureStream.of(1,1,1,1,1,1)
.batchBySize(3,()->new TreeSet<>())
.toList()
//[[1],[1]]
grouped in interface ReactiveSeq<U>grouped in interface Traversable<U>size - Size of batchsupplier - Create the batch holding collectiondefault LazyFutureStream<U> jitter(long jitterInNanos)
LazyFutureStream.parallelCommonBuilder()
.of(IntStream.range(0, 100))
.map(it -> it*100)
.jitter(10l)
.peek(System.out::println)
.block();
jitter in interface ReactiveSeq<U>jitterInNanos - Max number of nanos for jitter (random number less than this
will be selected)/default LazyFutureStream<U> fixedDelay(long time, java.util.concurrent.TimeUnit unit)
LazyFutureStream.of(1,2,3,4)
.fixedDelay(1,TimeUnit.hours);
Will emit 1 on start, then 2 after an hour, 3 after 2 hours and so on.
However all 4 numbers will be populated in the Stream immediately.
LazyFutureStream.of(1,2,3,4)
.withQueueFactories(QueueFactories.boundedQueue(1))
.fixedDelay(1,TimeUnit.hours);
Will populate each number in the Stream an hour apart.fixedDelay in interface ReactiveSeq<U>time - amount of time between emissionsunit - TimeUnit for emissionsdefault LazyFutureStream<U> onePer(long time, java.util.concurrent.TimeUnit unit)
LazyFutureStream.of(1,2,3,4,5,6)
.onePer(1000,TimeUnit.NANOSECONDS)
.toList();
onePer in interface ReactiveSeq<U>time - Frequency period of element emissionunit - Time unit for frequency perioddefault LazyFutureStream<U> xPer(int x, long time, java.util.concurrent.TimeUnit unit)
LazyFutureStream.of(1,2,3,4,5,6)
.xPer(6,100000000,TimeUnit.NANOSECONDS)
.toList();
xPer in interface ReactiveSeq<U>x - Number of allowable emissions per time periodtime - Frequency time periodunit - Frequency time unitdefault LazyFutureStream<ListX<U>> groupedByTime(long time, java.util.concurrent.TimeUnit unit)
LazyFutureStream.react(()->load1(),()->load2(),()->load3(),()->load4(),()->load5(),()->load6())
.batchByTime(15000,TimeUnit.MICROSECONDS);
groupedByTime in interface ReactiveSeq<U>time - Time period during which all elements should be collectedunit - Time unit during which all elements should be collecteddefault <C extends java.util.Collection<? super U>> LazyFutureStream<C> groupedByTime(long time, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<C> factory)
List <TreeSet<Integer>> set = LazyFutureStream.ofThread(1,1,1,1,1,1)
.batchByTime(1500,TimeUnit.MICROSECONDS,()-> new TreeSet<>())
.block();
assertThat(set.get(0).size(),is(1));
groupedByTime in interface ReactiveSeq<U>time - Time period during which all elements should be collectedunit - Time unit during which all elements should be collectedfactory - Instantiates the collections used in the batchingdefault <R> LazyFutureStream<R> then(java.util.function.Function<? super U,? extends R> fn, java.util.concurrent.Executor service)
then in interface BaseSimpleReactStream<U>then in interface LazySimpleReactStream<U>then in interface LazyToQueue<U>default <R> LazyFutureStream<R> then(java.util.function.Function<? super U,? extends R> fn)
LazySimpleReactStream
new SimpleReact().<Integer, Integer> react(() -> 1, () -> 2, () -> 3)
.then((it) -> it * 100)
.then((it) -> "*" + it)
React then allows event reactors to be chained. Unlike React with, which
returns a collection of Future references, React then is a fluent
interface that returns the React builder - allowing further reactors to
be added to the chain.
React then does not block.
React with can be called after React then which gives access to the full
CompleteableFuture api. CompleteableFutures can be passed back into
SimpleReact via SimpleReact.react(streamOfCompleteableFutures);
See this blog post for examples of what can be achieved via
CompleteableFuture :- http://www.nurkiewicz.com/2013/12/promises-and-completablefuture.htm
l then in interface BaseSimpleReactStream<U>then in interface LazySimpleReactStream<U>fn - Function to be applied to the results of the currently active
event tasksdefault java.util.List<LazyFutureStream<U>> copy(int times)
LazyFutureStream.of(1,2,3,4,5,6)
.map(i->i+2)
.copy(5)
.forEach(s -> System.out.println(s.toList()));
times - to copy this Streamdefault <R> LazyFutureStream<R> switchOnNextValue(java.util.stream.Stream<LazyFutureStream> streams)
LazyFutureStream<Integer> fast = ... // [1,2,3,4,5,6,7..]
LazyFutureStream<Integer> slow = ... // [100,200,300,400,500,600..]
LazyFutureStream<Integer> merged = fast.switchOnNextValue(Stream.of(slow)); //[1,2,3,4,5,6,7,8,100,9,10,11,12,13,14,15,16,200..]
streams - default <R> LazyFutureStream<R> mergeLatest(LazyFutureStream<?>... streams)
LazyFutureStream<Integer> fast = ... // [1,2,3,4,5,6,7..]
LazyFutureStream<Integer> slow = ... // [100,200,300,400,500,600..]
LazyFutureStream<Integer> merged = fast.mergeLatest(slow); //[1,2,3,4,5,6,7,8,100,9,10,11,12,13,14,15,16,200..]
streams - default LazyFutureStream<U> onFail(java.util.function.Function<? super SimpleReactFailedStageException,? extends U> fn)
LazySimpleReactStream
List<String> strings = new SimpleReact().<Integer, Integer> react(() -> 100, () -> 2, () -> 3)
.then(it -> {
if (it == 100)
throw new RuntimeException("boo!");
return it;
})
.onFail(e -> 1)
.then(it -> "*" + it)
.block();
In this example onFail recovers from the RuntimeException thrown when the
input to the first 'then' stage is 100.onFail in interface BaseSimpleReactStream<U>onFail in interface LazySimpleReactStream<U>fn - Recovery function, the exception is input, and the recovery
value is outputdefault LazyFutureStream<U> onFail(java.lang.Class<? extends java.lang.Throwable> exceptionClass, java.util.function.Function<? super SimpleReactFailedStageException,? extends U> fn)
LazySimpleReactStream
onFail(IOException.class, recoveryFunction1)
.onFail(Throwable.class,recovertyFunction2)
For an IOException recoveryFunction1 will be executed
but with the definitions reveresed
onFail(Throwable.class,recovertyFunction2)
.onFail(IOException.class, recoveryFunction1)
recoveryFunction1 will not be calledonFail in interface BaseSimpleReactStream<U>onFail in interface LazySimpleReactStream<U>exceptionClass - Class of exceptions to recover fromfn - Recovery functiondefault LazyFutureStream<U> capture(java.util.function.Consumer<java.lang.Throwable> errorHandler)
LazySimpleReactStream
List<String> strings = new SimpleReact().<Integer, Integer> react(() -> 1, () -> 2, () -> 3)
.then(it -> it * 100)
.then(it -> {
if (it == 100)
throw new RuntimeException("boo!");
return it;
})
.onFail(e -> 1)
.then(it -> "*" + it)
.then(it -> {
if ("*200".equals(it))
throw new RuntimeException("boo!");
return it;
})
.capture(e -> logger.error(e.getMessage(),e))
.block();
In this case, strings will only contain the two successful results (for
()->1 and ()->3), an exception for the chain starting from Supplier
()->2 will be logged by capture. Capture will not capture the
exception thrown when an Integer value of 100 is found, but will catch
the exception when the String value "*200" is passed along the chain.capture in interface BaseSimpleReactStream<U>capture in interface LazySimpleReactStream<U>errorHandler - A consumer that recieves and deals with an unrecoverable error
in the dataflowdefault LazyFutureStream<U> peek(java.util.function.Consumer<? super U> consumer)
Functor
of(1,2,3).map(System.out::println)
1
2
3
peek in interface BaseSimpleReactStream<U>peek in interface Functor<U>peek in interface LazySimpleReactStream<U>peek in interface ReactiveSeq<U>peek in interface org.jooq.lambda.Seq<U>peek in interface java.util.stream.Stream<U>consumer - Consumer that recieves each element from this Functordefault LazyFutureStream<U> filter(java.util.function.Predicate<? super U> p)
Filterable
of(1,2,3).filter(i->i>2);
//[3]
filter in interface BaseSimpleReactStream<U>filter in interface Filterable<U>filter in interface FilterableFunctor<U>filter in interface JoolManipulation<U>filter in interface LazySimpleReactStream<U>filter in interface ReactiveSeq<U>filter in interface org.jooq.lambda.Seq<U>filter in interface java.util.stream.Stream<U>p - to filter elements by, retaining matchesdefault <R> LazyFutureStream<R> flatMap(java.util.function.Function<? super U,? extends java.util.stream.Stream<? extends R>> flatFn)
LazySimpleReactStreamflatMap in interface BaseSimpleReactStream<U>flatMap in interface LazySimpleReactStream<U>flatMap in interface ReactiveSeq<U>flatMap in interface org.jooq.lambda.Seq<U>flatMap in interface java.util.stream.Stream<U>flatFn - Function that coverts a value (e.g. a Collection) into a Streamdefault <R> LazyFutureStream<R> flatMapAnyM(java.util.function.Function<? super U,AnyM<? extends R>> flatFn)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3)).flatMapAnyM(i-> anyM(CompletableFuture.completedFuture(i+2))).toList(),equalTo(Arrays.asList(3,4,5)));
flatMapAnyM in interface ReactiveSeq<U>flatFn - to be applieddefault <R> LazyFutureStream<R> flatMapCompletableFuture(java.util.function.Function<? super U,java.util.concurrent.CompletableFuture<? extends R>> flatFn)
assertThat( new LazyReact()
.of(1,2,3)
.flatMapCompletableFuture(i->CompletableFuture.completedFuture(i))
.block(),equalTo(Arrays.asList(1,2,3)));
In this example the result of the flatMapCompletableFuture is 'flattened' to the raw integer valuesflatFn - flatMap functiondefault <R> LazyFutureStream<R> retry(java.util.function.Function<? super U,? extends R> fn)
LazySimpleReactStreamretry in interface BaseSimpleReactStream<U>retry in interface LazySimpleReactStream<U>retry in interface ReactiveSeq<U>fn - Function that will be executed and retried on failuredefault <R> LazyFutureStream<R> fromStream(java.util.stream.Stream<R> stream)
fromStream in interface BaseSimpleReactStream<U>default <R> LazyFutureStream<R> fromStreamOfFutures(java.util.stream.Stream<FastFuture<R>> stream)
default LazyFutureStream<U> concat(java.util.stream.Stream<? extends U> other)
concat in interface ReactiveSeq<U>concat in interface org.jooq.lambda.Seq<U>Seq.concat(Stream[])default LazyFutureStream<U> concat(U other)
// (1, 2, 3, 4)
LazyFutureStream.of(1, 2, 3).concat(4)
concat in interface ReactiveSeq<U>concat in interface org.jooq.lambda.Seq<U>Seq.concat(Stream[])default LazyFutureStream<U> concat(U... other)
// (1, 2, 3, 4, 5, 6)
LazyFutureStream.of(1, 2, 3).concat(4, 5, 6)
concat in interface ReactiveSeq<U>concat in interface org.jooq.lambda.Seq<U>Seq.concat(Stream[])default <U> LazyFutureStream<U> cast(java.lang.Class<? extends U> type)
FunctorClassCastException.
// ClassCastException ReactiveSeq.of(1, "a", 2, "b", 3).cast(Integer.class)cast in interface BaseSimpleReactStream<U>cast in interface Functor<U>cast in interface ReactiveSeq<U>cast in interface org.jooq.lambda.Seq<U>default <U> LazyFutureStream<U> ofType(java.lang.Class<? extends U> type)
ofType in interface BaseSimpleReactStream<U>ofType in interface Filterable<U>ofType in interface JoolManipulation<U>ofType in interface ReactiveSeq<U>ofType in interface org.jooq.lambda.Seq<U>default LazyFutureStream<U> intersperse(U value)
// (1, 0, 2, 0, 3, 0, 4)
LazyFutureStream.of(1, 2, 3, 4).intersperse(0)
intersperse in interface BaseSimpleReactStream<U>intersperse in interface ReactiveSeq<U>intersperse in interface org.jooq.lambda.Seq<U>intersperse in interface Traversable<U>Seq.intersperse(Stream, Object)default LazyFutureStream<U> limit(long maxSize)
ReactiveSeq
assertThat(ReactiveSeq.of(4,3,6,7).limit(2).toList(),equalTo(Arrays.asList(4,3));
limit in interface ReactiveSeq<U>limit in interface org.jooq.lambda.Seq<U>limit in interface java.util.stream.Stream<U>limit in interface Traversable<U>maxSize - Limit element size to numdefault LazyFutureStream<U> takeWhile(java.util.function.Predicate<? super U> p)
takeWhile in interface ReactiveSeq<U>takeWhile in interface Traversable<U>default LazyFutureStream<U> dropWhile(java.util.function.Predicate<? super U> p)
dropWhile in interface ReactiveSeq<U>dropWhile in interface Traversable<U>default LazyFutureStream<U> takeUntil(java.util.function.Predicate<? super U> p)
takeUntil in interface ReactiveSeq<U>takeUntil in interface Traversable<U>default LazyFutureStream<U> dropUntil(java.util.function.Predicate<? super U> p)
dropUntil in interface ReactiveSeq<U>dropUntil in interface Traversable<U>default LazyFutureStream<U> dropRight(int num)
dropRight in interface ReactiveSeq<U>dropRight in interface Traversable<U>default LazyFutureStream<U> takeRight(int num)
takeRight in interface ReactiveSeq<U>takeRight in interface Traversable<U>default LazyFutureStream<U> skip(long n)
ReactiveSeq
assertThat(ReactiveSeq.of(4,3,6,7).skip(2).toList(),equalTo(Arrays.asList(6,7)));
skip in interface BaseSimpleReactStream<U>skip in interface ReactiveSeq<U>skip in interface org.jooq.lambda.Seq<U>skip in interface java.util.stream.Stream<U>skip in interface Traversable<U>n - Number of elemenets to skipdefault LazyFutureStream<U> distinct()
distinct in interface ReactiveSeq<U>distinct in interface org.jooq.lambda.Seq<U>distinct in interface java.util.stream.Stream<U>distinct in interface Traversable<U>default LazyFutureStream<ListX<U>> sliding(int size)
//futureStream of [1,2,3,4,5,6]
List<List<Integer>> list = futureStream.sliding(2)
.collect(Collectors.toList());
assertThat(list.get(0),hasItems(1,2));
assertThat(list.get(1),hasItems(2,3));
sliding in interface ReactiveSeq<U>sliding in interface Traversable<U>size - Size of sliding windowdefault LazyFutureStream<ListX<U>> sliding(int size, int increment)
//futureStream of [1,2,3,4,5,6,7,8]
List<List<Integer>> list = futureStream.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 ReactiveSeq<U>sliding in interface Traversable<U>size - Size of sliding windowincrement - for each windowdefault org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> duplicate()
// tuple((1, 2, 3), (1, 2, 3))
LazyFutureStream.of(1, 2, 3).duplicate()
default org.jooq.lambda.tuple.Tuple2<LazyFutureStream<U>,LazyFutureStream<U>> duplicateFutureStream()
default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> partition(java.util.function.Predicate<? super U> predicate)
// tuple((1, 3, 5), (2, 4, 6))
LazyFutureStream.of(1, 2, 3, 4, 5,6).partition(i -> i % 2 != 0)
partition in interface org.jooq.lambda.Seq<U>partitionFutureStream(Predicate),
Seq.partition(Stream, Predicate)default org.jooq.lambda.tuple.Tuple2<LazyFutureStream<U>,LazyFutureStream<U>> partitionFutureStream(java.util.function.Predicate<? super U> predicate)
LazyFutureStream.of(1, 2, 3, 4, 5, 6).partition(i -> i % 2 != 0)
results in
tuple((1, 3, 5), (2, 4, 6))
predicate - Predicate to split Streampartition(Predicate)default LazyFutureStream<U> slice(long from, long to)
slice in interface ReactiveSeq<U>slice in interface org.jooq.lambda.Seq<U>slice in interface Traversable<U>default LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,java.lang.Long>> zipWithIndex()
// (tuple("a", 0), tuple("b", 1), tuple("c", 2))
LazyFutureStream.of("a","b", "c").zipWithIndex()
zipWithIndex in interface ReactiveSeq<U>zipWithIndex in interface org.jooq.lambda.Seq<U>zipWithIndex in interface Traversable<U>Seq.zipWithIndex(Stream)default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> zip(org.jooq.lambda.Seq<? extends T> other)
// (tuple(1, "a"), tuple(2, "b"), tuple(3, "c"))
LazyFutureStream.of(1, 2, 3)
.zip(Seq.of("a", "b", "c"))
zip in interface ReactiveSeq<U>zip in interface org.jooq.lambda.Seq<U>zip in interface Traversable<U>Seq.zip(Stream, Stream)default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> zip(java.util.stream.Stream<? extends T> other)
ReactiveSeq
{
@code
List<Tuple2<Integer, String>> list = of(1, 2).zip(of("a", "b", "c", "d")).toList();
// [[1,"a"],[2,"b"]]
}
zip in interface ReactiveSeq<U>zip in interface org.jooq.lambda.Seq<U>zip in interface Traversable<U>default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> zip(java.lang.Iterable<? extends T> other)
zip in interface ReactiveSeq<U>zip in interface org.jooq.lambda.Seq<U>zip in interface Traversable<U>default <T,R> LazyFutureStream<R> zip(org.jooq.lambda.Seq<? extends T> other, java.util.function.BiFunction<? super U,? super T,? extends R> zipper)
BiFunction to produce resulting
values.
// ("1:a", "2:b", "3:c")
LazyFutureStream.of(1, 2, 3).zip(Seq.of("a", "b", "c"), (i, s) -> i + ":" + s)
zip in interface ReactiveSeq<U>zip in interface org.jooq.lambda.Seq<U>zip in interface Traversable<U>zip(Seq, BiFunction)default <T,R> LazyFutureStream<R> zip(java.util.stream.Stream<? extends T> other, java.util.function.BiFunction<? super U,? super T,? extends R> zipper)
zip in interface ReactiveSeq<U>zip in interface org.jooq.lambda.Seq<U>zip in interface Traversable<U>default <T,R> LazyFutureStream<R> zip(java.lang.Iterable<? extends T> other, java.util.function.BiFunction<? super U,? super T,? extends R> zipper)
zip in interface ReactiveSeq<U>zip in interface org.jooq.lambda.Seq<U>zip in interface Traversable<U>default <T> LazyFutureStream<T> scanLeft(T seed, java.util.function.BiFunction<? super T,? super U,? extends T> function)
scanLeft in interface ReactiveSeq<U>scanLeft in interface org.jooq.lambda.Seq<U>scanLeft in interface Traversable<U>default <R> LazyFutureStream<R> scanRight(R seed, java.util.function.BiFunction<? super U,? super R,? extends R> function)
scanRight in interface ReactiveSeq<U>scanRight in interface org.jooq.lambda.Seq<U>scanRight in interface Traversable<U>default LazyFutureStream<U> scanRight(Monoid<U> monoid)
ReactiveSeq
assertThat(of("a", "b", "c").scanRight(Monoid.of("", String::concat)).toList().size(),
is(asList("", "c", "bc", "abc").size()));
scanRight in interface ReactiveSeq<U>scanRight in interface Traversable<U>default LazyFutureStream<U> reverse()
reverse in interface ReactiveSeq<U>reverse in interface org.jooq.lambda.Seq<U>reverse in interface Traversable<U>default LazyFutureStream<U> shuffle()
shuffle in interface ReactiveSeq<U>shuffle in interface org.jooq.lambda.Seq<U>shuffle in interface Traversable<U>default LazyFutureStream<U> shuffle(java.util.Random random)
shuffle in interface ReactiveSeq<U>shuffle in interface org.jooq.lambda.Seq<U>shuffle in interface Traversable<U>default LazyFutureStream<U> skipWhile(java.util.function.Predicate<? super U> predicate)
skipWhile in interface ReactiveSeq<U>skipWhile in interface org.jooq.lambda.Seq<U>skipWhile in interface Traversable<U>predicate - Predicate to skip while trueSeq.skipWhile(Stream, Predicate)default LazyFutureStream<U> skipUntil(java.util.function.Predicate<? super U> predicate)
skipUntil in interface ReactiveSeq<U>skipUntil in interface org.jooq.lambda.Seq<U>skipUntil in interface Traversable<U>predicate - Predicate to skip until trueSeq.skipUntil(Stream, Predicate)default LazyFutureStream<U> limitWhile(java.util.function.Predicate<? super U> predicate)
limitWhile in interface ReactiveSeq<U>limitWhile in interface org.jooq.lambda.Seq<U>limitWhile in interface Traversable<U>predicate - Limit while predicate is trueSeq.limitWhile(Stream, Predicate)default LazyFutureStream<U> limitUntil(java.util.function.Predicate<? super U> predicate)
limitUntil in interface ReactiveSeq<U>limitUntil in interface org.jooq.lambda.Seq<U>limitUntil in interface Traversable<U>predicate - Limit until predicate is trueSeq.limitUntil(Stream, Predicate)default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> crossJoin(java.util.stream.Stream<? extends T> other)
// (tuple(1, "a"), tuple(1, "b"), tuple(2, "a"), tuple(2, "b"))
LazyFutureStream.of(1, 2).crossJoin(LazyFutureStream.of("a", "b"))
crossJoin in interface ReactiveSeq<U>crossJoin in interface org.jooq.lambda.Seq<U>default LazyFutureStream<U> onEmpty(U value)
value, in case this stream is empty.
LazyFutureStream.of().onEmpty(1)
//1
onEmpty in interface ReactiveSeq<U>onEmpty in interface org.jooq.lambda.Seq<U>onEmpty in interface Traversable<U>default LazyFutureStream<U> onEmptyGet(java.util.function.Supplier<? extends U> supplier)
supplier, in case this stream is empty.
LazyFutureStream.of().onEmptyGet(() -> 1)
//1
onEmptyGet in interface ReactiveSeq<U>onEmptyGet in interface org.jooq.lambda.Seq<U>onEmptyGet in interface Traversable<U>default <X extends java.lang.Throwable> LazyFutureStream<U> onEmptyThrow(java.util.function.Supplier<? extends X> supplier)
supplier, in case this stream is empty.
LazyFutureStream.of().capture(e -> ex = e).onEmptyThrow(() -> new RuntimeException()).toList();
//throws RuntimeException
onEmptyThrow in interface ReactiveSeq<U>onEmptyThrow in interface org.jooq.lambda.Seq<U>onEmptyThrow in interface Traversable<U>default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> innerJoin(java.util.stream.Stream<? extends T> other, java.util.function.BiPredicate<? super U,? super T> predicate)
// (tuple(1, 1), tuple(2, 2))
LazyFutureStream.of(1, 2, 3).innerJoin(Seq.of(1, 2), t -> Objects.equals(t.v1, t.v2))
innerJoin in interface ReactiveSeq<U>innerJoin in interface org.jooq.lambda.Seq<U>default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> leftOuterJoin(java.util.stream.Stream<? extends T> other, java.util.function.BiPredicate<? super U,? super T> predicate)
// (tuple(1, 1), tuple(2, 2), tuple(3, null))
LazyFutureStream.of(1, 2, 3).leftOuterJoin(Seq.of(1, 2), t -> Objects.equals(t.v1, t.v2))
leftOuterJoin in interface ReactiveSeq<U>leftOuterJoin in interface org.jooq.lambda.Seq<U>default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> rightOuterJoin(java.util.stream.Stream<? extends T> other, java.util.function.BiPredicate<? super U,? super T> predicate)
// (tuple(1, 1), tuple(2, 2), tuple(null, 3))
LazyFutureStream.of(1, 2).rightOuterJoin(Seq.of(1, 2, 3), t -> Objects.equals(t.v1, t.v2))
rightOuterJoin in interface ReactiveSeq<U>rightOuterJoin in interface org.jooq.lambda.Seq<U>default LazyFutureStream<U> cycle()
assertThat(LazyFutureStream.of(1,2,2).cycle().limit(6)
.collect(Collectors.toList()),
equalTo(Arrays.asList(1,2,2,1,2,2));
cycle in interface ReactiveSeq<U>cycle in interface org.jooq.lambda.Seq<U>default LazyFutureStream<U> cycle(int times)
assertThat(LazyFutureStream.of(1,2,2).cycle(3)
.collect(Collectors.toList()),
equalTo(Arrays.asList(1,2,2,1,2,2,1,2,2)));
cycle in interface ReactiveSeq<U>cycle in interface Traversable<U>times - Times values should be repeated within a Streamdefault LazyFutureStream<U> cycleWhile(java.util.function.Predicate<? super U> predicate)
int count =0;
assertThat(LazyFutureStream.of(1,2,2).cycleWhile(next -> count++<6 )
.collect(Collectors.toList()),equalTo(Arrays.asList(1,2,2,1,2,2)));
cycleWhile in interface ReactiveSeq<U>cycleWhile in interface Traversable<U>predicate - repeat while truedefault LazyFutureStream<U> cycleUntil(java.util.function.Predicate<? super U> predicate)
count =0;
assertThat(LazyFutureStream.of(1,2,2,3).cycleUntil(next -> count++>10 )
.collect(Collectors.toList()),equalTo(Arrays.asList(1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2)));
cycleUntil in interface ReactiveSeq<U>cycleUntil in interface Traversable<U>predicate - repeat while truedefault IterableFoldable<U> foldable()
default ReactiveSeq<U> stream()
ReactiveSeqstream in interface ConvertableSequence<U>stream in interface ExtendedTraversable<U>stream in interface Foldable<U>stream in interface IterableFunctor<U>stream in interface ReactiveSeq<U>stream in interface org.jooq.lambda.Seq<U>stream in interface TransformerTraversable<U>stream in interface Traversable<U>default LazyFutureStream<U> parallel()
default LazyFutureStream<U> sequential()
sequential in interface java.util.stream.BaseStream<U,java.util.stream.Stream<U>>sequential in interface ReactiveSeq<U>sequential in interface org.jooq.lambda.Seq<U>default LazyFutureStream<U> unordered()
default LazyFutureStream<U> onClose(java.lang.Runnable closeHandler)
default LazyFutureStream<U> sorted()
ReactiveSeq
assertThat(ReactiveSeq.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7)));
sorted in interface ReactiveSeq<U>sorted in interface org.jooq.lambda.Seq<U>sorted in interface java.util.stream.Stream<U>sorted in interface Traversable<U>default LazyFutureStream<U> sorted(java.util.Comparator<? super U> comparator)
ReactiveSeq
assertThat(ReactiveSeq.of(4,3,6,7).sorted((a,b) -> b-a).toList(),equalTo(Arrays.asList(7,6,4,3)));
sorted in interface ReactiveSeq<U>sorted in interface org.jooq.lambda.Seq<U>sorted in interface java.util.stream.Stream<U>sorted in interface Traversable<U>comparator - Compartor to sort withdefault LazyFutureStream<U> self(java.util.function.Consumer<LazyFutureStream<U>> consumer)
consumer - Consumer that will recieve current stagedefault <R> R unwrap()
unwrap in interface ReactiveSeq<U>unwrap in interface Unwrapabledefault <T1> LazyFutureStream<T1> flatten()
ReactiveSeq
ReactiveSeq.of(Arrays.asList(1,2)).flatten();
//stream of (1, 2);
flatten in interface ReactiveSeq<U>default java.util.Optional<ListX<U>> toOptional()
ConvertableSequence
Optional<List<String>> stream = anyM("hello","world")
.asSequence()
.unwrapOptional();
assertThat(stream.get(),equalTo(Arrays.asList("hello","world")));
toOptional in interface ConvertableSequence<U>default java.util.concurrent.CompletableFuture<ListX<U>> toCompletableFuture()
ConvertableSequence
CompletableFuture<List<String>> cf = anyM("hello","world")
.asSequence()
.unwrapCompletableFuture();
assertThat(cf.join(),equalTo(Arrays.asList("hello","world")));
toCompletableFuture in interface ConvertableSequence<U>default java.util.Spliterator<U> spliterator()
default boolean isParallel()
default java.util.stream.IntStream mapToInt(java.util.function.ToIntFunction<? super U> mapper)
default java.util.stream.LongStream mapToLong(java.util.function.ToLongFunction<? super U> mapper)
default java.util.stream.DoubleStream mapToDouble(java.util.function.ToDoubleFunction<? super U> mapper)
default java.util.stream.IntStream flatMapToInt(java.util.function.Function<? super U,? extends java.util.stream.IntStream> mapper)
default java.util.stream.LongStream flatMapToLong(java.util.function.Function<? super U,? extends java.util.stream.LongStream> mapper)
default java.util.stream.DoubleStream flatMapToDouble(java.util.function.Function<? super U,? extends java.util.stream.DoubleStream> mapper)
default void forEachOrdered(java.util.function.Consumer<? super U> action)
forEachOrdered in interface java.util.stream.Stream<U>default java.lang.Object[] toArray()
toArray in interface java.util.stream.Stream<U>default <A> A[] toArray(java.util.function.IntFunction<A[]> generator)
toArray in interface java.util.stream.Stream<U>default java.util.Optional<U> findAny()
findAny in interface Foldable<U>findAny in interface ReactiveSeq<U>findAny in interface java.util.stream.Stream<U>
ReactiveSeq.of(1,2,3,4,5).filter(it -> it <3).findAny().get();
//3
(non-deterministic)default java.util.Set<U> toSet()
toSet in interface org.jooq.lambda.Collectable<U>toSet in interface CyclopsCollectable<U>toSet in interface ReactiveSeq<U>default java.util.List<U> toList()
toList in interface org.jooq.lambda.Collectable<U>toList in interface CyclopsCollectable<U>toList in interface ReactiveSeq<U>default <C extends java.util.Collection<U>> C toCollection(java.util.function.Supplier<C> collectionFactory)
toCollection in interface org.jooq.lambda.Collectable<U>toCollection in interface CyclopsCollectable<U>toCollection in interface ReactiveSeq<U>default <R> ReactiveSeq<U> distinct(java.util.function.Function<? super U,? extends R> keyExtractor)
distinct in interface ReactiveSeq<U>distinct in interface org.jooq.lambda.Seq<U>default org.jooq.lambda.tuple.Tuple2<ReactiveSeq<U>,ReactiveSeq<U>> duplicateSequence()
ReactiveSeq
{
@code
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));
}
duplicateSequence in interface ReactiveSeq<U>default org.jooq.lambda.tuple.Tuple3<ReactiveSeq<U>,ReactiveSeq<U>,ReactiveSeq<U>> triplicate()
ReactiveSeq
{
@code
Tuple3<ReactiveSeq<Tuple3<T1, T2, T3>>, ReactiveSeq<Tuple3<T1, T2, T3>>, ReactiveSeq<Tuple3<T1, T2, T3>>> Tuple3 = sequence.triplicate();
}
triplicate in interface ReactiveSeq<U>default org.jooq.lambda.tuple.Tuple4<ReactiveSeq<U>,ReactiveSeq<U>,ReactiveSeq<U>,ReactiveSeq<U>> quadruplicate()
ReactiveSeq
{
@code
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<U>default org.jooq.lambda.tuple.Tuple2<java.util.Optional<U>,ReactiveSeq<U>> splitSequenceAtHead()
ReactiveSeq
ReactiveSeq.of(1,2,3).splitAtHead()
//Optional[1], ReactiveSeq[2,3]
splitSequenceAtHead in interface ReactiveSeq<U>default org.jooq.lambda.tuple.Tuple2<ReactiveSeq<U>,ReactiveSeq<U>> splitAt(int where)
ReactiveSeq
ReactiveSeq.of(1,2,3).splitAt(1)
//ReactiveSeq[1], ReactiveSeq[2,3]
splitAt in interface ReactiveSeq<U>default org.jooq.lambda.tuple.Tuple2<ReactiveSeq<U>,ReactiveSeq<U>> splitBy(java.util.function.Predicate<U> 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<U>default org.jooq.lambda.tuple.Tuple2<ReactiveSeq<U>,ReactiveSeq<U>> partitionSequence(java.util.function.Predicate<U> splitter)
ReactiveSeq
ReactiveSeq.of(1, 2, 3, 4, 5, 6).partition(i -> i % 2 != 0)
//ReactiveSeq[1,3,5], ReactiveSeq[2,4,6]
partitionSequence in interface ReactiveSeq<U>default LazyFutureStream<U> cycle(Monoid<U> m, int times)
ReactiveSeq
List<Integer> list = ReactiveSeq.of(1,2,2))
.cycle(Reducers.toCountInt(),3)
.collect(Collectors.toList());
//List[3,3,3];
cycle in interface ReactiveSeq<U>cycle in interface Traversable<U>m - Monoid to be used in reductiontimes - Number of times value should be repeateddefault <S,R> LazyFutureStream<org.jooq.lambda.tuple.Tuple3<U,S,R>> zip3(java.util.stream.Stream<? extends S> second, java.util.stream.Stream<? extends R> third)
ReactiveSeq
{
@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 ReactiveSeq<U>zip3 in interface Traversable<U>default <T2,T3,T4> LazyFutureStream<org.jooq.lambda.tuple.Tuple4<U,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)
ReactiveSeq
{
@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 ReactiveSeq<U>zip4 in interface Traversable<U>default <S,R> LazyFutureStream<R> zipStream(java.util.stream.BaseStream<? extends S,? extends java.util.stream.BaseStream<? extends S,?>> second, java.util.function.BiFunction<? super U,? super S,? extends R> zipper)
ReactiveSeq
{
@code
Stream<List<Integer>> zipped = asMonad(Stream.of(1, 2, 3)).zip(Stream.of(2, 3, 4), (a, b) -> Arrays.asList(a, b));
// [[1,2][2,3][3,4]]
}
zipStream in interface ReactiveSeq<U>second - Stream to zip withzipper - Zip funcitondefault LazyFutureStream<ListX<U>> grouped(int groupSize)
ReactiveSeq
{
@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 ReactiveSeq<U>grouped in interface Traversable<U>groupSize - Size of each Groupdefault LazyFutureStream<U> scanLeft(Monoid<U> monoid)
ReactiveSeq
assertEquals(asList("", "a", "ab", "abc"),ReactiveSeq.of("a", "b", "c")
.scanLeft(Reducers.toString("")).toList());
scanLeft in interface ReactiveSeq<U>scanLeft in interface Traversable<U>default Streamable<U> toStreamable()
ReactiveSeq
Streamable<Integer> repeat = ReactiveSeq.of(1,2,3,4,5,6)
.map(i->i*2)
.toStreamable();
repeat.sequenceM().toList(); //Arrays.asList(2,4,6,8,10,12));
repeat.sequenceM().toList() //Arrays.asList(2,4,6,8,10,12));
toStreamable in interface ConvertableSequence<U>toStreamable in interface ReactiveSeq<U>default <U> java.util.stream.Stream<U> toStream()
ReactiveSeqtoStream in interface ReactiveSeq<U>default boolean startsWithIterable(java.lang.Iterable<U> iterable)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Arrays.asList(1,2,3)));
startsWithIterable in interface Foldable<U>startsWithIterable in interface ReactiveSeq<U>default boolean startsWith(java.util.stream.Stream<U> iterator)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Stream.of(1,2,3)))
startsWith in interface Foldable<U>startsWith in interface ReactiveSeq<U>default boolean endsWithIterable(java.lang.Iterable<U> iterable)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Arrays.asList(5,6)));
endsWithIterable in interface Foldable<U>endsWithIterable in interface ReactiveSeq<U>iterable - Values to checkdefault boolean endsWith(java.util.stream.Stream<U> stream)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Stream.of(5,6)));
default AnyMSeq<U> anyM()
anyM in interface ReactiveSeq<U>default <R> LazyFutureStream<R> flatMapIterable(java.util.function.Function<? super U,? extends java.lang.Iterable<? extends R>> fn)
ReactiveSeq
ReactiveSeq.of(1,2)
.flatMap(i -> asList(i, -i))
.toList();
//1,-1,2,-2
flatMapIterable in interface ReactiveSeq<U>default <R> LazyFutureStream<R> flatMapStream(java.util.function.Function<? super U,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<U>fn - to be applieddefault CollectionX<U> toLazyCollection()
ReactiveSeq
{
@code
Collection<Integer> col = ReactiveSeq.of(1, 2, 3, 4, 5).peek(System.out::println).toLazyCollection();
col.forEach(System.out::println);
}
// Will print out "first!" before anything else
toLazyCollection in interface Foldable<U>toLazyCollection in interface ReactiveSeq<U>default CollectionX<U> toConcurrentLazyCollection()
ReactiveSeq
{
@code
Collection<Integer> col = ReactiveSeq.of(1, 2, 3, 4, 5).peek(System.out::println).toConcurrentLazyCollection();
col.forEach(System.out::println);
}
// Will print out "first!" before anything else
toConcurrentLazyCollection in interface Foldable<U>toConcurrentLazyCollection in interface ReactiveSeq<U>default Streamable<U> toConcurrentLazyStreamable()
ReactiveSeq
{
@code
Streamable<Integer> repeat = ReactiveSeq.of(1, 2, 3, 4, 5, 6).map(i -> i + 2).toConcurrentLazyStreamable();
assertThat(repeat.sequenceM().toList(), equalTo(Arrays.asList(2, 4, 6, 8, 10, 12)));
assertThat(repeat.sequenceM().toList(), equalTo(Arrays.asList(2, 4, 6, 8, 10, 12)));
}
toConcurrentLazyStreamable in interface Foldable<U>toConcurrentLazyStreamable in interface ReactiveSeq<U>default LazyFutureStream<U> appendStream(java.util.stream.Stream<U> stream)
ReactiveSeq
{
@code
List<String> result = ReactiveSeq.of(1, 2, 3).appendStream(ReactiveSeq.of(100, 200, 300)).map(it -> it + "!!").collect(Collectors.toList());
assertThat(result, equalTo(Arrays.asList("1!!", "2!!", "3!!", "100!!", "200!!", "300!!")));
}
appendStream in interface ReactiveSeq<U>stream - to appenddefault LazyFutureStream<U> prependStream(java.util.stream.Stream<U> stream)
ReactiveSeq
{
@code
List<String> result = ReactiveSeq.of(1, 2, 3).prependStream(of(100, 200, 300)).map(it -> it + "!!").collect(Collectors.toList());
assertThat(result, equalTo(Arrays.asList("100!!", "200!!", "300!!", "1!!", "2!!", "3!!")));
}
prependStream in interface ReactiveSeq<U>stream - to Prependdefault LazyFutureStream<U> append(U... values)
ReactiveSeq
{
@code
List<String> result = ReactiveSeq.of(1, 2, 3).append(100, 200, 300).map(it -> it + "!!").collect(Collectors.toList());
assertThat(result, equalTo(Arrays.asList("1!!", "2!!", "3!!", "100!!", "200!!", "300!!")));
}
append in interface ReactiveSeq<U>append in interface org.jooq.lambda.Seq<U>values - to appenddefault LazyFutureStream<U> prepend(U... values)
ReactiveSeq
List<String> result = ReactiveSeq.of(1,2,3)
.prepend(100,200,300)
.map(it ->it+"!!")
.collect(Collectors.toList());
assertThat(result,equalTo(Arrays.asList("100!!","200!!","300!!","1!!","2!!","3!!")));
prepend in interface ReactiveSeq<U>prepend in interface org.jooq.lambda.Seq<U>values - to prependdefault LazyFutureStream<U> insertAt(int pos, U... values)
ReactiveSeq
{
@code
List<String> result = ReactiveSeq.of(1, 2, 3).insertAt(1, 100, 200, 300).map(it -> it + "!!").collect(Collectors.toList());
assertThat(result, equalTo(Arrays.asList("1!!", "100!!", "200!!", "300!!", "2!!", "3!!")));
}
insertAt in interface ReactiveSeq<U>pos - to insert data atvalues - to insertdefault LazyFutureStream<U> deleteBetween(int start, int end)
ReactiveSeq
{
@code
List<String> result = ReactiveSeq.of(1, 2, 3, 4, 5, 6).deleteBetween(2, 4).map(it -> it + "!!").collect(Collectors.toList());
assertThat(result, equalTo(Arrays.asList("1!!", "2!!", "5!!", "6!!")));
}
deleteBetween in interface ReactiveSeq<U>start - indexend - indexdefault LazyFutureStream<U> insertStreamAt(int pos, java.util.stream.Stream<U> stream)
ReactiveSeq
{
@code
List<String> result = ReactiveSeq.of(1, 2, 3).insertStreamAt(1, of(100, 200, 300)).map(it -> it + "!!").collect(Collectors.toList());
assertThat(result, equalTo(Arrays.asList("1!!", "100!!", "200!!", "300!!", "2!!", "3!!")));
}
insertStreamAt in interface ReactiveSeq<U>pos - to insert Stream atstream - to insertdefault FutureOperations<U> futureOperations()
default FutureOperations<U> futureOperations(java.util.concurrent.Executor exec)
ReactiveSeqfutureOperations in interface ReactiveSeq<U>futureOperations in interface Traversable<U>exec - Executor to use for Stream executiondefault LazyFutureStream<U> skip(long time, java.util.concurrent.TimeUnit unit)
ReactiveSeq
{
@code
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<U>time - Length of timeunit - Time unitdefault LazyFutureStream<U> limit(long time, java.util.concurrent.TimeUnit unit)
ReactiveSeq
{
@code
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<U>time - Length of timeunit - Time unitdefault LazyFutureStream<U> skipLast(int num)
ReactiveSeqskipLast in interface ReactiveSeq<U>skipLast in interface Traversable<U>default LazyFutureStream<U> limitLast(int num)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5)
.limitLast(2)
.collect(Collectors.toList()),equalTo(Arrays.asList(4,5)));
limitLast in interface ReactiveSeq<U>limitLast in interface Traversable<U>num - of elements to return (last elements)default U firstValue()
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4)
.map(u->{throw new RuntimeException();})
.recover(e->"hello")
.firstValue(),equalTo("hello"));
firstValue in interface Foldable<U>firstValue in interface ReactiveSeq<U>default <C extends java.util.Collection<? super U>> LazyFutureStream<C> groupedBySizeAndTime(int size, long time, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<C> factory)
ReactiveSeq
{
@code
List<ArrayList<Integer>> list = of(1, 2, 3, 4, 5, 6).batchBySizeAndTime(10, 1, TimeUnit.MICROSECONDS, () -> new ArrayList<>()).toList();
}
groupedBySizeAndTime in interface ReactiveSeq<U>size - Max size of a batchtime - (Max) time period to build a single batch inunit - time unit for batchfactory - Collection factorydefault LazyFutureStream<ListX<U>> groupedStatefullyWhile(java.util.function.BiPredicate<ListX<? super U>,? super U> predicate)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedStatefullyWhile((s,i)-> s.contains(4) ? true : false)
.toList().size(),equalTo(5));
groupedStatefullyWhile in interface ReactiveSeq<U>groupedStatefullyWhile in interface Traversable<U>predicate - Window while truedefault LazyFutureStream<ListX<U>> groupedUntil(java.util.function.Predicate<? super U> predicate)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.batchUntil(i->i%3==0)
.toList()
.size(),equalTo(2));
groupedUntil in interface ReactiveSeq<U>groupedUntil in interface Traversable<U>predicate - Batch until predicate holds, then open next batchdefault LazyFutureStream<ListX<U>> groupedWhile(java.util.function.Predicate<? super U> predicate)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.batchWhile(i->i%3!=0)
.toList().size(),equalTo(2));
groupedWhile in interface ReactiveSeq<U>groupedWhile in interface Traversable<U>predicate - Batch while predicate holds, then open next batchdefault <C extends java.util.Collection<? super U>> LazyFutureStream<C> groupedWhile(java.util.function.Predicate<? super U> 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 ReactiveSeq<U>groupedWhile in interface Traversable<U>predicate - Batch while predicate holds, then open next batchfactory - Collection factorydefault <R extends java.lang.Comparable<? super R>> LazyFutureStream<U> sorted(java.util.function.Function<? super U,? extends R> function)
sorted in interface ReactiveSeq<U>sorted in interface org.jooq.lambda.Seq<U>sorted in interface Traversable<U>default <C extends java.util.Collection<? super U>> LazyFutureStream<C> groupedUntil(java.util.function.Predicate<? super U> predicate, java.util.function.Supplier<C> factory)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.batchUntil(i->i%3!=0)
.toList()
.size(),equalTo(2));
groupedUntil in interface ReactiveSeq<U>groupedUntil in interface Traversable<U>predicate - Batch until predicate holds, then open next batchfactory - Collection factorydefault LazyFutureStream<U> recover(java.util.function.Function<java.lang.Throwable,? extends U> 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 ReactiveSeq<U>fn - Function that accepts a Throwable and returns an alternative
valuedefault <EX extends java.lang.Throwable> LazyFutureStream<U> recover(java.lang.Class<EX> exceptionClass, java.util.function.Function<EX,? extends U> 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 ReactiveSeq<U>exceptionClass - Type to recover fromfn - That accepts an error and returns an alternative valuedefault <X extends java.lang.Throwable> org.reactivestreams.Subscription forEachX(long numberOfElements,
java.util.function.Consumer<? super U> consumer)
forEachX in interface ReactiveStreamsTerminalOperations<U>numberOfElements - To consume from the Stream at this timeconsumer - To accept incoming events from the Streamdefault <X extends java.lang.Throwable> org.reactivestreams.Subscription forEachXWithError(long numberOfElements,
java.util.function.Consumer<? super U> consumer,
java.util.function.Consumer<? super java.lang.Throwable> consumerError)
forEachXWithError in interface ReactiveStreamsTerminalOperations<U>numberOfElements - To consume from the Stream at this timeconsumer - To accept incoming elements from the StreamconsumerError - To accept incoming processing errors from the StreamonComplete - To run after an onComplete eventdefault <X extends java.lang.Throwable> org.reactivestreams.Subscription forEachXEvents(long numberOfElements,
java.util.function.Consumer<? super U> consumer,
java.util.function.Consumer<? super java.lang.Throwable> consumerError,
java.lang.Runnable onComplete)
forEachXEvents in interface ReactiveStreamsTerminalOperations<U>numberOfElements - To consume from the Stream at this timeconsumer - To accept incoming elements from the StreamconsumerError - To accept incoming processing errors from the StreamonComplete - To run after an onComplete eventdefault <X extends java.lang.Throwable> void forEachWithError(java.util.function.Consumer<? super U> consumerElement, java.util.function.Consumer<? super java.lang.Throwable> consumerError)
forEachWithError in interface ReactiveStreamsTerminalOperations<U>consumer - To accept incoming elements from the StreamconsumerError - To accept incoming processing errors from the Streamdefault <X extends java.lang.Throwable> void forEachEvent(java.util.function.Consumer<? super U> consumerElement, java.util.function.Consumer<? super java.lang.Throwable> consumerError, java.lang.Runnable onComplete)
forEachEvent in interface ReactiveStreamsTerminalOperations<U>consumer - To accept incoming elements from the StreamconsumerError - To accept incoming processing errors from the StreamonComplete - To run after an onComplete eventstatic <U> LazyFutureStream<U> parallel(U... array)
parallel in interface BaseSimpleReactStream<U>array - Values to react toThreadPools.getStandard(),
ThreadPools.setUseCommon(boolean)static <T> LazyFutureStream<T> lazyFutureStreamFrom(java.util.stream.Stream<java.util.concurrent.CompletableFuture<T>> stream)
static <T> LazyFutureStream<T> lazyFutureStream(java.util.concurrent.CompletableFuture<T> value)
static <T> LazyFutureStream<T> lazyFutureStream(java.util.concurrent.CompletableFuture<T>... values)
static <T> LazyFutureStream<T> react(java.util.function.Supplier<T> value)
react in interface BaseSimpleReactStream<U>Stream.of(Object)@SafeVarargs static <T> LazyFutureStream<T> react(java.util.function.Supplier<T>... values)
react in interface BaseSimpleReactStream<U>static <T> LazyFutureStream<T> of(T value)
of in interface BaseSimpleReactStream<U>of in interface ReactiveSeq<U>of in interface org.jooq.lambda.Seq<U>of in interface java.util.stream.Stream<U>value - To Construct sequence from@SafeVarargs static <T> LazyFutureStream<T> of(T... values)
of in interface BaseSimpleReactStream<U>of in interface ReactiveSeq<U>of in interface org.jooq.lambda.Seq<U>of in interface java.util.stream.Stream<U>values - To Construct sequence fromstatic <T> LazyFutureStream<T> freeThread(T value)
freeThread in interface BaseSimpleReactStream<U>ThreadPools.setUseCommon(boolean)@SafeVarargs static <T> LazyFutureStream<T> freeThread(T... values)
freeThread in interface BaseSimpleReactStream<U>ThreadPools.setUseCommon(boolean)static <T> LazyFutureStream<T> empty()
empty in interface BaseSimpleReactStream<U>empty in interface ReactiveSeq<U>empty in interface org.jooq.lambda.Seq<U>empty in interface java.util.stream.Stream<U>static <T> LazyFutureStream<T> iterate(T seed, java.util.function.UnaryOperator<T> f)
iterate in interface ReactiveSeq<U>iterate in interface org.jooq.lambda.Seq<U>iterate in interface java.util.stream.Stream<U>Stream.iterate(Object, UnaryOperator)static LazyFutureStream<java.lang.Void> generate()
generate in interface org.jooq.lambda.Seq<U>Stream.generate(Supplier)static <T> LazyFutureStream<T> generate(T value)
generate in interface ReactiveSeq<U>generate in interface org.jooq.lambda.Seq<U>generate in interface java.util.stream.Stream<U>Stream.generate(Supplier)static <T> LazyFutureStream<T> generate(java.util.function.Supplier<T> s)
generate in interface ReactiveSeq<U>generate in interface org.jooq.lambda.Seq<U>generate in interface java.util.stream.Stream<U>Stream.generate(Supplier)static <T> LazyFutureStream<T> lazyFutureStream(java.util.stream.Stream<T> stream)
static <T> LazyFutureStream<T> lazyFutureStreamFromIterable(java.lang.Iterable<T> iterable)
static <T> LazyFutureStream<T> lazyFutureStream(java.util.Iterator<T> iterator)