public interface LazyFutureStream<U> extends LazySimpleReactStream<U>, LazyStream<U>, FutureStream<U>, LazyToQueue<U>, ConfigurableStream<U,FastFuture<U>>, FutureStreamAsyncPublisher<U>, FutureStreamSynchronousPublisher<U>
softener
Modifier and Type | Method and Description |
---|---|
default LazyFutureStream<U> |
async() |
default <C extends java.util.Collection<U>> |
batch(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<java.util.List<U>> |
batchBySize(int size)
Batch the elements in this stream into Lists of specified size
|
default <C extends java.util.Collection<U>> |
batchBySize(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<java.util.List<U>> |
batchBySizeAndTime(int size,
long time,
java.util.concurrent.TimeUnit unit)
Batch the elements in the Stream by a combination of Size and Time
If batch exceeds max size it will be split
If batch exceeds max time it will be split
Excludes Null values (neccessary for timeout handling)
|
default LazyFutureStream<java.util.Collection<U>> |
batchByTime(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 LazyFutureStream<java.util.Collection<U>> |
batchByTime(long time,
java.util.concurrent.TimeUnit unit,
java.util.function.Supplier<java.util.Collection<U>> factory)
Organise elements in a Stream into a Collections based on the time period
they pass through this stage
|
default LazyFutureStream<U> |
boundedWaitFree(int size)
Use an Agrona ManyToOneConcurrentArrayQueue for the next operations (wait-free, mechanical sympathy).
|
void |
cancel()
Cancel the CompletableFutures in this stage of the stream
|
default LazyFutureStream<U> |
capture(java.util.function.Consumer<? extends 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<U> type) |
static void |
close(java.util.Iterator it) |
default void |
closeAll() |
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<U> |
concat(java.util.stream.Stream<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 EagerFutureStream<U> |
convertToEagerStream()
Convert between an Lazy and Eager future stream,
can be used to take advantages of each approach during a single Stream
|
default java.util.List<LazyFutureStream<U>> |
copy(int times)
Copy this Stream the specified number of times
|
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
crossJoin(java.util.stream.Stream<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> |
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> |
distinct() |
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>> |
duplicateFutures()
Duplicate a Stream into two equivalent LazyFutureStreams
LazyFutureStream.of(1, 2, 3).duplicate()
results in
tuple((1,2,3),(1,2,3))
Care should be taken not to use this method with infinite streams!
|
default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> |
duplicateFuturesSeq()
Duplicate a Stream into two equivalent Sequences
LazyFutureStream.of(1, 2, 3).duplicate()
results in
tuple((1,2,3),(1,2,3))
Care should be taken not to use this method with infinite streams!
|
default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> |
duplicateFutureStream() |
static <T> LazyFutureStream<T> |
empty()
Create a sequential synchronous stream that runs on the current thread
|
default LazyFutureStream<U> |
filter(java.util.function.Predicate<? super U> p)
Removes elements that do not match the supplied predicate from the
dataflow
|
default java.util.Optional<U> |
findFirst()
Returns an
Optional describing the first element of this stream,
or an empty Optional if the stream is empty. |
static <U> LazyFutureStream<U> |
firstOf(LazyFutureStream<U>... futureStreams)
Return first Stream out of provided Streams that starts emitted results
|
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> |
flatMapCompletableFuture(java.util.function.Function<U,java.util.concurrent.CompletableFuture<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> |
flatMapCompletableFutureSync(java.util.function.Function<U,java.util.concurrent.CompletableFuture<R>> flatFn)
Perform a flatMap operation where the CompletableFuture type returned is flattened from the resulting Stream
This operation is performed synchronously
|
default void |
forEach(java.util.function.Consumer<? super U> c)
Stream supporting methods
|
default <R> LazyFutureStream<R> |
fromStream(java.util.stream.Stream<R> stream) |
default <R> LazyFutureStream<R> |
fromStreamOfFutures(java.util.stream.Stream<FastFuture<R>> stream) |
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 <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
innerJoin(java.util.stream.Stream<T> other,
java.util.function.BiPredicate<U,T> predicate)
Inner join 2 streams into one.
|
default LazyFutureStream<U> |
intersperse(U value)
Returns a stream with a given value interspersed between any two values
of this stream.
|
static <T> LazyFutureStream<T> |
iterate(T seed,
java.util.function.UnaryOperator<T> f) |
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<T> other,
java.util.function.BiPredicate<U,T> predicate)
Left outer join 2 streams into one.
|
default LazyFutureStream<U> |
limit(long maxSize) |
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.
|
static <T> org.jooq.lambda.Seq<T> |
limitUntil(java.util.stream.Stream<T> stream,
java.util.function.Predicate<? super T> predicate)
Returns a stream ed to all elements for which a predicate evaluates to
true . |
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.
|
static <T> org.jooq.lambda.Seq<T> |
limitWhile(java.util.stream.Stream<T> stream,
java.util.function.Predicate<? super T> 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) |
default 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.
|
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
|
static <T> LazyFutureStream<T> |
ofThread(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> |
ofThread(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 <U> LazyFutureStream<U> |
ofType(java.lang.Class<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<U> supplier)
Produce this stream, or an alternative stream from the
supplier , in case this stream is empty. |
default <X extends java.lang.Throwable> |
onEmptyThrow(java.util.function.Supplier<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<SimpleReactFailedStageException,U> fn)
Recover for a particular class of exceptions only.
|
default LazyFutureStream<U> |
onFail(java.util.function.Function<SimpleReactFailedStageException,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 LazyFutureStream<U> |
peek(java.util.function.Consumer<? super U> consumer)
Peek asynchronously at the results in the current stage.
|
default LazyFutureStream<U> |
peekSync(java.util.function.Consumer<? super U> consumer)
Synchronous peek operator
|
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 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,
java.util.function.BinaryOperator<T> combiner) |
default U |
reduce(U identity,
java.util.function.BinaryOperator<U> accumulator) |
default <R> LazyFutureStream<R> |
retry(java.util.function.Function<U,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<T> other,
java.util.function.BiPredicate<U,T> predicate)
Right outer join 2 streams into one.
|
default <T> LazyFutureStream<T> |
scanLeft(T seed,
java.util.function.BiFunction<T,? super U,T> function)
Scan a stream to the left.
|
default <R> LazyFutureStream<R> |
scanRight(R seed,
java.util.function.BiFunction<? super U,R,R> function)
Scan a stream to the right.
|
default LazyFutureStream<U> |
self(java.util.function.Consumer<FutureStream<U>> consumer)
Give a function access to the current stage of a SimpleReact 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<U,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) |
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)
Returns a limited interval from a given Stream.
|
default LazyFutureStream<java.util.List<U>> |
sliding(int size)
Create a sliding view over this Stream
|
default LazyFutureStream<java.util.List<U>> |
sliding(int size,
int increment)
Create a sliding view over this Stream
|
default LazyFutureStream<U> |
sorted() |
default LazyFutureStream<U> |
sorted(java.util.Comparator<? super U> comparator) |
default java.util.stream.Stream<U> |
stream() |
default void |
subscribe(org.reactivestreams.Subscriber<? super U> s) |
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 <R> LazyFutureStream<R> |
then(java.util.function.Function<U,R> fn)
Override return type on SimpleReactStream
|
default <R> LazyFutureStream<R> |
then(java.util.function.Function<U,R> fn,
java.util.concurrent.Executor service) |
default <R> LazyFutureStream<R> |
thenSync(java.util.function.Function<U,R> fn) |
default Queue<U> |
toQueue()
Convert the current Stream to a simple-react Queue
|
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() |
LazyFutureStream<U> |
withAsync(boolean async) |
<R> LazyFutureStream<R> |
withLastActive(LazyStreamWrapper<R> streamWrapper) |
LazyFutureStream<U> |
withLazyCollector(java.util.function.Supplier<LazyResultConsumer<U>> lazy) |
LazyFutureStream<U> |
withParallelReduction(ParallelReductionConfig parallelReductionConfig) |
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 FutureStream<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(org.jooq.lambda.Seq<T> other)
Zip two streams into one.
|
default <T,R> LazyFutureStream<R> |
zip(org.jooq.lambda.Seq<T> other,
java.util.function.BiFunction<U,T,R> zipper)
Zip two streams into one using a
BiFunction to produce resulting
values. |
static <T1,T2> org.jooq.lambda.Seq<org.jooq.lambda.tuple.Tuple2<T1,T2>> |
zip(java.util.stream.Stream<T1> left,
java.util.stream.Stream<T2> right)
Zip two streams into one.
|
static <T1,T2,R> org.jooq.lambda.Seq<R> |
zip(java.util.stream.Stream<T1> left,
java.util.stream.Stream<T2> right,
java.util.function.BiFunction<T1,T2,R> zipper)
Zip two streams into one using a
BiFunction to produce resulting
values. |
default <R> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,R>> |
zipFutures(FutureStream<R> other)
Zip two Streams, zipping against the underlying futures of both Streams
Placeholders (Futures) will be populated immediately in the new zipped Stream and results
will be populated asyncrhonously
|
default <R> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,R>> |
zipFutures(java.util.stream.Stream<R> other)
Zip two Streams, zipping against the underlying futures of this stream
|
default LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,java.lang.Long>> |
zipFuturesWithIndex()
Zip this Stream with an index, but Zip based on the underlying tasks, not completed results.
|
default LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,java.lang.Long>> |
zipWithIndex()
Zip a Stream with a corresponding Stream of indexes.
|
assureSimpleReactException, copySimpleReactStream, doOnEach, doOnEachSync, filterSync, getLastActive, handleExceptions, streamCompletableFutures, withErrorHandler
getErrorHandler, getRetrier, getTaskExecutor, isAsync
getErrorHandler, getLastActive, getLazyCollector, getMaxActive, getParallelReduction, run, run, runContinuation, runOn, runOnCurrent, runThread
allMatch, anyMatch, batchBySizeAndTime, cast, chunkLastReadIterator, chunkSinceLastRead, close, count, findAny, firstValue, flatMapToDouble, flatMapToInt, flatMapToLong, forEachOrdered, futureOperations, futureOperations, getLastActive, getTaskExecutor, intersperse, isAsync, isParallel, iterator, lift, lift2, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, ofType, reversedIterator, single, slice, spliterator, toArray, toArray, toConcurrentLazyCollection, toLazyCollection
cast, concat, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, cycle, distinct, duplicate, foldLeft, foldLeft, foldRight, foldRight, groupBy, groupBy, groupBy, groupBy, groupBy, groupBy, intersperse, isEmpty, isNotEmpty, join, join, join, join, join, join, limit, maxBy, maxBy, minBy, minBy, ofType, partition, reverse, scanLeft, scanRight, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, shuffle, shuffle, skip, skipUntil, skipWhile, slice, sorted, splitAt, splitAt, splitAtHead, splitAtHead, toCollection, toCollection, toList, toList, toList, toMap, toMap, toMap, toSet, toSet, toSet, toString, toString, toString, unfold, unzip, unzip, unzip, unzip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipWithIndex
getQueueFactory, simpleReactStream, simpleReactStream, simpleReactStream, simpleReactStream, simpleReactStreamFrom, simpleReactStreamFromIterable
add, addToQueue, getPopulator, returnPopulator, toQueue, toQueue
getQueueFactory
forwardErrors, getLastActive, getPublisherExecutor, subscribeAsync, subscribeOn, withPublisherExecutor
forwardErrors, getLastActive, subscribeSync
Continueable getSubscription()
getSubscription
in interface FutureStream<U>
getSubscription
in interface LazySimpleReactStream<U>
getSubscription
in interface SimpleReactStream<U>
void cancel()
FutureStream
cancel
in interface FutureStream<U>
cancel
in interface FutureStreamAsyncPublisher<U>
cancel
in interface FutureStreamSynchronousPublisher<U>
<R> LazyFutureStream<R> withLastActive(LazyStreamWrapper<R> streamWrapper)
withLastActive
in interface LazySimpleReactStream<U>
LazyReact getSimpleReact()
getSimpleReact
in interface ConfigurableStream<U,FastFuture<U>>
getSimpleReact
in interface SimpleReactStream<U>
default void subscribe(org.reactivestreams.Subscriber<? super U> s)
subscribe
in interface FutureStreamAsyncPublisher<U>
subscribe
in interface FutureStreamSynchronousPublisher<U>
subscribe
in interface org.reactivestreams.Publisher<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 ConfigurableStream<U,FastFuture<U>>
withRetrier
in interface LazySimpleReactStream<U>
withRetrier
in interface SimpleReactStream<U>
LazyFutureStream<U> withLazyCollector(java.util.function.Supplier<LazyResultConsumer<U>> lazy)
LazyFutureStream<U> withQueueFactory(QueueFactory<U> queue)
withQueueFactory
in interface ConfigurableStream<U,FastFuture<U>>
withQueueFactory
in interface FutureStream<U>
withQueueFactory
in interface LazySimpleReactStream<U>
withQueueFactory
in interface SimpleReactStream<U>
LazyFutureStream<U> withSubscription(Continueable sub)
withSubscription
in interface ConfigurableStream<U,FastFuture<U>>
withSubscription
in interface LazySimpleReactStream<U>
withSubscription
in interface SimpleReactStream<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)
FutureStream
forEach
in interface FutureStream<U>
forEach
in interface java.lang.Iterable<U>
forEach
in interface LazyStream<U>
forEach
in interface org.jooq.lambda.Seq<U>
forEach
in interface java.util.stream.Stream<U>
default Queue<U> toQueue()
LazyToQueue
toQueue
in interface FutureStreamAsyncPublisher<U>
toQueue
in interface FutureStreamSynchronousPublisher<U>
toQueue
in interface LazyToQueue<U>
toQueue
in interface SimpleReactStream<U>
toQueue
in interface ToQueue<U>
default U reduce(U identity, java.util.function.BinaryOperator<U> accumulator)
reduce
in interface FutureStream<U>
reduce
in interface LazyStream<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 FutureStream<U>
reduce
in interface LazyStream<U>
reduce
in interface java.util.stream.Stream<U>
default java.util.Optional<U> reduce(java.util.function.BinaryOperator<U> accumulator)
reduce
in interface FutureStream<U>
reduce
in interface LazyStream<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 FutureStream<U>
collect
in interface LazyStream<U>
collect
in interface java.util.stream.Stream<U>
default LazyFutureStream<U> sync()
sync
in interface FutureStream<U>
sync
in interface SimpleReactStream<U>
default LazyFutureStream<U> async()
async
in interface FutureStream<U>
async
in interface SimpleReactStream<U>
default LazyFutureStream<U> unboundedWaitFree()
default LazyFutureStream<U> boundedWaitFree(int size)
size
- Buffer sizedefault LazyFutureStream<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<U,R> fn)
thenSync
in interface LazySimpleReactStream<U>
thenSync
in interface LazyToQueue<U>
thenSync
in interface SimpleReactStream<U>
default LazyFutureStream<U> peekSync(java.util.function.Consumer<? super U> consumer)
LazySimpleReactStream
peekSync
in interface LazySimpleReactStream<U>
peekSync
in interface LazyToQueue<U>
peekSync
in interface SimpleReactStream<U>
consumer
- Peek consumerdefault void closeAll()
default java.util.Optional<U> findFirst()
Optional
describing the first element of this stream,
or an empty Optional
if the stream is empty. If the stream has
no encounter order, then any element may be returned.
This is a short-circuiting terminal operation.
findFirst
in interface FutureStream<U>
findFirst
in interface java.util.stream.Stream<U>
Optional
describing the first element of this stream,
or an empty Optional
if the stream is emptyjava.lang.NullPointerException
- if the element selected is nulldefault EagerFutureStream<U> convertToEagerStream()
convertToEagerStream
in interface SimpleReactStream<U>
default <R> LazyFutureStream<R> map(java.util.function.Function<? super U,? extends R> mapper)
map
in interface FutureStream<U>
map
in interface org.jooq.lambda.Seq<U>
map
in interface java.util.stream.Stream<U>
default LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,java.lang.Long>> zipFuturesWithIndex()
LazyFutureStream.react(()-gt;takesALotOfTime(),()-gt;veryQuick()).zipWithIndex();
[["takesALotOfTime",0],["veryQuick",1]]
Where as with standard zipWithIndex you would get a new Stream ordered by completion
[["veryQuick",0],["takesALotOfTime",1]]
Care should be taken not to use this method with infinite streams!default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> duplicateFuturesSeq()
duplicate()
default org.jooq.lambda.tuple.Tuple2<LazyFutureStream<U>,LazyFutureStream<U>> duplicateFutures()
duplicate()
default <R> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,R>> zipFutures(java.util.stream.Stream<R> other)
zipFutures
in interface FutureStream<U>
other
- default <R> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,R>> zipFutures(FutureStream<R> other)
zipFutures
in interface FutureStream<U>
other
- Another FutureStream to zip Futures withdefault <K> java.util.Map<K,LazyFutureStream<U>> shard(java.util.Map<K,Queue<U>> shards, java.util.function.Function<U,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,43shard
in interface FutureStream<U>
shards
- 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)
debounce
in interface FutureStream<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)
control
in interface FutureStream<U>
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> batch(java.util.function.Function<java.util.function.Supplier<U>,java.util.function.Supplier<C>> fn)
batch
in interface FutureStream<U>
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<java.util.List<U>> batchBySize(int size)
batchBySize
in interface FutureStream<U>
size
- Size of lists elements should be batched intodefault LazyFutureStream<java.util.List<U>> batchBySizeAndTime(int size, long time, java.util.concurrent.TimeUnit unit)
FutureStream
batchBySizeAndTime
in interface FutureStream<U>
default <C extends java.util.Collection<U>> LazyFutureStream<C> batchBySize(int size, java.util.function.Supplier<C> supplier)
batchBySize
in interface FutureStream<U>
size
- Size of batchsupplier
- Create the batch holding collectiondefault LazyFutureStream<U> jitter(long jitterInNanos)
jitter
in interface FutureStream<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)
fixedDelay
in interface FutureStream<U>
time
- amount of time between emissionsunit
- TimeUnit for emissionsdefault LazyFutureStream<U> onePer(long time, java.util.concurrent.TimeUnit unit)
onePer
in interface FutureStream<U>
time
- Frequency period of element emissionunit
- Time unit for frequency perioddefault FutureStream<U> xPer(int x, long time, java.util.concurrent.TimeUnit unit)
xPer
in interface FutureStream<U>
x
- Number of allowable emissions per time periodtime
- Frequency time periodunit
- Frequency time unitdefault LazyFutureStream<java.util.Collection<U>> batchByTime(long time, java.util.concurrent.TimeUnit unit)
LazyFutureStream.react(()->load1(),()->load2(),()->load3(),()->load4(),()->load5(),()->load6())
.batchByTime(15000,TimeUnit.MICROSECONDS);
batchByTime
in interface FutureStream<U>
time
- Time period during which all elements should be collectedunit
- Time unit during which all elements should be collecteddefault LazyFutureStream<java.util.Collection<U>> batchByTime(long time, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<java.util.Collection<U>> factory)
batchByTime
in interface FutureStream<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 batching@SafeVarargs static <U> LazyFutureStream<U> firstOf(LazyFutureStream<U>... futureStreams)
futureStreams
- Streams to racedefault <R> LazyFutureStream<R> then(java.util.function.Function<U,R> fn, java.util.concurrent.Executor service)
then
in interface LazySimpleReactStream<U>
then
in interface LazyToQueue<U>
then
in interface SimpleReactStream<U>
default <R> LazyFutureStream<R> then(java.util.function.Function<U,R> fn)
then
in interface LazySimpleReactStream<U>
then
in interface SimpleReactStream<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<SimpleReactFailedStageException,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 FutureStream<U>
onFail
in interface LazySimpleReactStream<U>
onFail
in interface SimpleReactStream<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<SimpleReactFailedStageException,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 LazySimpleReactStream<U>
onFail
in interface SimpleReactStream<U>
exceptionClass
- Class of exceptions to recover fromfn
- Recovery functiondefault LazyFutureStream<U> capture(java.util.function.Consumer<? extends 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 FutureStream<U>
capture
in interface LazySimpleReactStream<U>
capture
in interface SimpleReactStream<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)
LazySimpleReactStream
peek
in interface FutureStream<U>
peek
in interface LazySimpleReactStream<U>
peek
in interface org.jooq.lambda.Seq<U>
peek
in interface SimpleReactStream<U>
peek
in interface java.util.stream.Stream<U>
consumer
- That will recieve current resultsdefault LazyFutureStream<U> filter(java.util.function.Predicate<? super U> p)
LazySimpleReactStream
filter
in interface FutureStream<U>
filter
in interface LazySimpleReactStream<U>
filter
in interface org.jooq.lambda.Seq<U>
filter
in interface SimpleReactStream<U>
filter
in interface java.util.stream.Stream<U>
p
- Predicate that will be used to filter elements from the
dataflowdefault <R> LazyFutureStream<R> flatMap(java.util.function.Function<? super U,? extends java.util.stream.Stream<? extends R>> flatFn)
LazySimpleReactStream
flatMap
in interface FutureStream<U>
flatMap
in interface LazySimpleReactStream<U>
flatMap
in interface org.jooq.lambda.Seq<U>
flatMap
in interface SimpleReactStream<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> flatMapCompletableFuture(java.util.function.Function<U,java.util.concurrent.CompletableFuture<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 valuesflatMapCompletableFuture
in interface LazySimpleReactStream<U>
flatMapCompletableFuture
in interface SimpleReactStream<U>
flatFn
- flatMap functiondefault <R> LazyFutureStream<R> flatMapCompletableFutureSync(java.util.function.Function<U,java.util.concurrent.CompletableFuture<R>> flatFn)
assertThat( new LazyReact()
.of(1,2,3)
.flatMapCompletableFutureSync(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 valuesflatMapCompletableFutureSync
in interface LazySimpleReactStream<U>
flatMapCompletableFutureSync
in interface SimpleReactStream<U>
flatFn
- flatMap functiondefault <R> LazyFutureStream<R> retry(java.util.function.Function<U,R> fn)
LazySimpleReactStream
retry
in interface LazySimpleReactStream<U>
retry
in interface SimpleReactStream<U>
fn
- Function that will be executed and retried on failuredefault <R> LazyFutureStream<R> fromStream(java.util.stream.Stream<R> stream)
fromStream
in interface FutureStream<U>
fromStream
in interface SimpleReactStream<U>
default <R> LazyFutureStream<R> fromStreamOfFutures(java.util.stream.Stream<FastFuture<R>> stream)
default LazyFutureStream<U> concat(java.util.stream.Stream<U> other)
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 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 org.jooq.lambda.Seq<U>
Seq.concat(Stream[])
default <U> LazyFutureStream<U> cast(java.lang.Class<U> type)
cast
in interface FutureStream<U>
cast
in interface org.jooq.lambda.Seq<U>
default <U> LazyFutureStream<U> ofType(java.lang.Class<U> type)
ofType
in interface FutureStream<U>
ofType
in interface org.jooq.lambda.Seq<U>
FutureStream.ofType(java.lang.Class)
default LazyFutureStream<U> intersperse(U value)
// (1, 0, 2, 0, 3, 0, 4)
LazyFutureStream.of(1, 2, 3, 4).intersperse(0)
intersperse
in interface FutureStream<U>
intersperse
in interface org.jooq.lambda.Seq<U>
Seq.intersperse(Stream, Object)
default LazyFutureStream<U> limit(long maxSize)
default LazyFutureStream<U> skip(long n)
default LazyFutureStream<U> distinct()
default LazyFutureStream<java.util.List<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 FutureStream<U>
size
- Size of sliding windowdefault LazyFutureStream<java.util.List<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 FutureStream<U>
size
- Size of sliding 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<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<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)
FutureStream
slice
in interface FutureStream<U>
slice
in interface org.jooq.lambda.Seq<U>
Seq.slice(Stream, long, long)
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 org.jooq.lambda.Seq<U>
Seq.zipWithIndex(Stream)
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> zip(org.jooq.lambda.Seq<T> other)
// (tuple(1, "a"), tuple(2, "b"), tuple(3, "c"))
Seq.of(1, 2, 3).zip(Seq.of("a", "b", "c"))
zip
in interface org.jooq.lambda.Seq<U>
zip(Stream, Stream)
default <T,R> LazyFutureStream<R> zip(org.jooq.lambda.Seq<T> other, java.util.function.BiFunction<U,T,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 org.jooq.lambda.Seq<U>
zip(Seq, BiFunction)
default <T> LazyFutureStream<T> scanLeft(T seed, java.util.function.BiFunction<T,? super U,T> function)
scanLeft
in interface org.jooq.lambda.Seq<U>
default <R> LazyFutureStream<R> scanRight(R seed, java.util.function.BiFunction<? super U,R,R> function)
scanRight
in interface org.jooq.lambda.Seq<U>
default LazyFutureStream<U> reverse()
reverse
in interface FutureStream<U>
reverse
in interface org.jooq.lambda.Seq<U>
default LazyFutureStream<U> shuffle()
shuffle
in interface org.jooq.lambda.Seq<U>
default LazyFutureStream<U> shuffle(java.util.Random random)
shuffle
in interface org.jooq.lambda.Seq<U>
default LazyFutureStream<U> skipWhile(java.util.function.Predicate<? super U> predicate)
skipWhile
in interface org.jooq.lambda.Seq<U>
Seq.skipWhile(Stream, Predicate)
default LazyFutureStream<U> skipUntil(java.util.function.Predicate<? super U> predicate)
skipUntil
in interface org.jooq.lambda.Seq<U>
Seq.skipUntil(Stream, Predicate)
default LazyFutureStream<U> limitWhile(java.util.function.Predicate<? super U> predicate)
limitWhile
in interface org.jooq.lambda.Seq<U>
limitWhile(Stream, Predicate)
default LazyFutureStream<U> limitUntil(java.util.function.Predicate<? super U> predicate)
limitUntil
in interface org.jooq.lambda.Seq<U>
limitUntil(Stream, Predicate)
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> crossJoin(java.util.stream.Stream<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 FutureStream<U>
crossJoin
in interface org.jooq.lambda.Seq<U>
default LazyFutureStream<U> onEmpty(U value)
value
, in case this stream is empty.onEmpty
in interface FutureStream<U>
onEmpty
in interface org.jooq.lambda.Seq<U>
default LazyFutureStream<U> onEmptyGet(java.util.function.Supplier<U> supplier)
supplier
, in case this stream is empty.onEmptyGet
in interface FutureStream<U>
onEmptyGet
in interface org.jooq.lambda.Seq<U>
default <X extends java.lang.Throwable> LazyFutureStream<U> onEmptyThrow(java.util.function.Supplier<X> supplier)
supplier
, in case this stream is empty.onEmptyThrow
in interface FutureStream<U>
onEmptyThrow
in interface org.jooq.lambda.Seq<U>
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> innerJoin(java.util.stream.Stream<T> other, java.util.function.BiPredicate<U,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 FutureStream<U>
innerJoin
in interface org.jooq.lambda.Seq<U>
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> leftOuterJoin(java.util.stream.Stream<T> other, java.util.function.BiPredicate<U,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 FutureStream<U>
leftOuterJoin
in interface org.jooq.lambda.Seq<U>
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> rightOuterJoin(java.util.stream.Stream<T> other, java.util.function.BiPredicate<U,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 FutureStream<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 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)));
default 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)));
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)));
predicate
- repeat while truestatic <T1,T2> org.jooq.lambda.Seq<org.jooq.lambda.tuple.Tuple2<T1,T2>> zip(java.util.stream.Stream<T1> left, java.util.stream.Stream<T2> right)
// (tuple(1, "a"), tuple(2, "b"), tuple(3, "c"))
Seq.of(1, 2, 3).zip(Seq.of("a", "b", "c"))
zip
in interface org.jooq.lambda.Seq<U>
static <T1,T2,R> org.jooq.lambda.Seq<R> zip(java.util.stream.Stream<T1> left, java.util.stream.Stream<T2> right, java.util.function.BiFunction<T1,T2,R> zipper)
BiFunction
to produce resulting
values.
// ("1:a", "2:b", "3:c")
Seq.of(1, 2, 3).zip(Seq.of("a", "b", "c"), (i, s) -> i + ":" + s)
zip
in interface org.jooq.lambda.Seq<U>
static void close(java.util.Iterator it)
static <T> org.jooq.lambda.Seq<T> limitWhile(java.util.stream.Stream<T> stream, java.util.function.Predicate<? super T> predicate)
true
.
// (1, 2)
Seq.of(1, 2, 3, 4, 5).limitWhile(i -> i < 3)
limitWhile
in interface org.jooq.lambda.Seq<U>
static <T> org.jooq.lambda.Seq<T> limitUntil(java.util.stream.Stream<T> stream, java.util.function.Predicate<? super T> predicate)
true
.
// (1, 2)
Seq.of(1, 2, 3, 4, 5).limitUntil(i -> i == 3)
limitUntil
in interface org.jooq.lambda.Seq<U>
default java.util.stream.Stream<U> stream()
stream
in interface FutureStream<U>
stream
in interface org.jooq.lambda.Seq<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 FutureStream<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()
sorted
in interface FutureStream<U>
sorted
in interface org.jooq.lambda.Seq<U>
sorted
in interface java.util.stream.Stream<U>
default LazyFutureStream<U> sorted(java.util.Comparator<? super U> comparator)
sorted
in interface FutureStream<U>
sorted
in interface org.jooq.lambda.Seq<U>
sorted
in interface java.util.stream.Stream<U>
default LazyFutureStream<U> self(java.util.function.Consumer<FutureStream<U>> consumer)
self
in interface FutureStream<U>
consumer
- Consumer that will recieve current stageLazyFutureStream<U> withParallelReduction(ParallelReductionConfig parallelReductionConfig)
static <U> LazyFutureStream<U> parallel(U... array)
parallel
in interface SimpleReactStream<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 SimpleReactStream<U>
Stream.of(Object)
@SafeVarargs static <T> LazyFutureStream<T> react(java.util.function.Supplier<T>... values)
react
in interface SimpleReactStream<U>
static <T> LazyFutureStream<T> of(T value)
of
in interface org.jooq.lambda.Seq<U>
of
in interface SimpleReactStream<U>
of
in interface java.util.stream.Stream<U>
@SafeVarargs static <T> LazyFutureStream<T> of(T... values)
of
in interface org.jooq.lambda.Seq<U>
of
in interface SimpleReactStream<U>
of
in interface java.util.stream.Stream<U>
static <T> LazyFutureStream<T> ofThread(T value)
ofThread
in interface SimpleReactStream<U>
ThreadPools.setUseCommon(boolean)
@SafeVarargs static <T> LazyFutureStream<T> ofThread(T... values)
ofThread
in interface SimpleReactStream<U>
ThreadPools.setUseCommon(boolean)
static <T> LazyFutureStream<T> empty()
empty
in interface org.jooq.lambda.Seq<U>
empty
in interface SimpleReactStream<U>
empty
in interface java.util.stream.Stream<U>
static <T> LazyFutureStream<T> iterate(T seed, java.util.function.UnaryOperator<T> f)
static LazyFutureStream<java.lang.Void> generate()
generate
in interface org.jooq.lambda.Seq<U>
Stream.generate(Supplier)
static <T> LazyFutureStream<T> generate(T value)
static <T> LazyFutureStream<T> generate(java.util.function.Supplier<T> s)
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)