public interface EagerFutureStream<U> extends org.jooq.lambda.Seq<U>, FutureStream<U>, EagerSimpleReactStream<U>, EagerToQueue<U>
softener
Modifier and Type | Method and Description |
---|---|
default <T,R> EagerFutureStream<R> |
allOf(java.util.stream.Collector collector,
java.util.function.Function<T,R> fn) |
default <T,R> EagerFutureStream<R> |
allOf(java.util.function.Function<java.util.List<T>,R> fn)
React and allOf
allOf is a non-blocking equivalent of block.
|
default <R> EagerFutureStream<R> |
anyOf(java.util.function.Function<U,R> fn)
React to the completion of any of the events in the previous stage.
|
default EagerFutureStream<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 EagerFutureStream<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 EagerFutureStream<java.util.List<U>> |
batchBySizeAndTime(int batchSize,
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 EagerFutureStream<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
This version uses locks - for a lock free implementation choose
|
default void |
cancel()
Cancel the CompletableFutures in this stage of the stream and the initial
phase
|
default EagerFutureStream<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> EagerFutureStream<U> |
cast(java.lang.Class<U> type) |
default EagerFutureStream<java.util.Collection<U>> |
chunkSinceLastRead() |
default void |
close() |
default <T> FutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
combineLatest(EagerSimpleReactStream<T> s)
Similar to zip and withLatest, except will always take the latest from either Stream (merged with last available from the other).
|
default EagerFutureStream<U> |
concat(java.util.stream.Stream<U> other)
Concatenate two streams.
|
default EagerFutureStream<U> |
concat(U... other)
Concatenate two streams.
|
default EagerFutureStream<U> |
concat(U other)
Concatenate two streams.
|
default EagerFutureStream<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 LazyFutureStream<U> |
convertToLazyStream()
Convert between an Eager and Lazy future stream,
can be used to take advantages of each approach during a single Stream
|
default java.util.List<EagerFutureStream<U>> |
copy(int times) |
default <T> EagerFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
crossJoin(java.util.stream.Stream<T> other)
Cross join 2 streams into one.
|
default EagerFutureStream<U> |
cycle()
UnsupportedOperation for EagerFutureStreams
Requires ability to support infinite Streams
|
default EagerFutureStream<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 EagerFutureStream<U> |
distinct() |
default EagerFutureStream<U> |
doOnEach(java.util.function.Function<U,U> fn)
Can only be used on Eager Streams
Applies a function to this phase independent on the main flow.
|
default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> |
duplicate()
Duplicate a Stream into two equivalent LazyFutureStreams, Streams are duplicated as results
of Futures are populated
|
default org.jooq.lambda.tuple.Tuple2<EagerFutureStream<U>,EagerFutureStream<U>> |
duplicateFutures()
Duplicate a Stream into two equivalent LazyFutureStreams, underlying
Stream of Futures is duplicated
|
static <T> EagerFutureStream<T> |
eagerFutureStream(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> EagerFutureStream<T> |
eagerFutureStream(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> EagerFutureStream<T> |
eagerFutureStream(java.util.Iterator<T> iterator)
Wrap an Iterator into a FutureStream that runs on the current thread
|
static <T> EagerFutureStream<T> |
eagerFutureStream(java.util.stream.Stream<T> stream)
Wrap a Stream into a Sequential synchronous FutureStream that runs on the current thread
|
static <T> EagerFutureStream<T> |
eagerFutureStreamFrom(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> EagerFutureStream<T> |
eagerFutureStreamFromIterable(java.lang.Iterable<T> iterable)
Wrap an Iterable into a FutureStream that runs on the current thread
|
static <T> EagerFutureStream<T> |
empty()
Create an empty sequential synchronous stream that runs on the current thread
|
default EagerFutureStream<U> |
filter(java.util.function.Predicate<? super U> p)
Removes elements that do not match the supplied predicate from the
dataflow
|
static <U> EagerFutureStream<U> |
firstOf(EagerFutureStream<U>... futureStreams)
Return first Stream out of provided Streams that starts emitted results
|
default EagerFutureStream<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> EagerFutureStream<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> EagerFutureStream<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> EagerFutureStream<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 <R> EagerFutureStream<R> |
fromListCompletableFuture(java.util.List<java.util.concurrent.CompletableFuture<R>> list) |
default <R> EagerFutureStream<R> |
fromStream(java.util.stream.Stream<R> stream) |
default <R> EagerFutureStream<R> |
fromStreamOfFutures(java.util.stream.Stream<java.util.concurrent.CompletableFuture<R>> stream)
Construct a SimpleReactStream from provided Stream of CompletableFutures
|
EagerStreamWrapper |
getLastActive() |
default <T> EagerFutureStream<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 EagerFutureStream<U> |
intersperse(U value)
Returns a stream with a given value interspersed between any two values
of this stream.
|
default EagerFutureStream<U> |
jitter(long jitterInNanos)
Introduce a random delay between events in a stream Can be used to
prevent behaviour synchronizing within a system
EagerFutureStreams will batch results before jittering
For a better implementation see @see LazyFutureStream#jitter(long)
|
default <T> EagerFutureStream<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 EagerFutureStream<U> |
limit(long maxSize) |
default EagerFutureStream<U> |
limitFutures(long maxSize)
Perform a limit operation on the underlying Stream of Futures
In contrast to EagerFutureStream#limit this removes entries basaed on their
start position
|
default EagerFutureStream<U> |
limitUntil(java.util.function.Predicate<? super U> predicate)
Returns a stream limited to all elements for which a predicate evaluates
to false.
|
default EagerFutureStream<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> EagerFutureStream<R> |
map(java.util.function.Function<? super U,? extends R> mapper) |
default EagerFutureStream<U> |
merge(EagerSimpleReactStream<U>... streams) |
static <R> EagerFutureStream<R> |
mergeMultiple(EagerFutureStream... s)
Merge two reactive dataflows with one and another.
|
static <T> EagerFutureStream<T> |
of(T... values)
Create a sequential synchronous stream that runs on the current thread
|
static <T> EagerFutureStream<T> |
of(T value)
Create a sequential synchronous stream that runs on the current thread
|
static <T> EagerFutureStream<T> |
ofThread(T... values)
Create a sequential synchronous stream that runs on the current thread
|
static <T> EagerFutureStream<T> |
ofThread(T value)
Create a sequential synchronous stream that runs on the current thread
|
default <U> EagerFutureStream<U> |
ofType(java.lang.Class<U> type)
Keep only those elements in a stream that are of a given type.
|
default EagerFutureStream<U> |
onClose(java.lang.Runnable closeHandler) |
default EagerFutureStream<U> |
onEmpty(U value)
Produce this stream, or an alternative stream from the
value , in case this stream is empty. |
default EagerFutureStream<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 EagerFutureStream<U> |
onePer(long time,
java.util.concurrent.TimeUnit unit)
Slow emissions down, emiting one element per specified time period
|
default EagerFutureStream<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 EagerFutureStream<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 EagerFutureStream<U> |
parallel() |
static <U> EagerFutureStream<U> |
parallel(U... array)
Construct an EagerFutureStream Stream from specified array, that will run in parallel
on the common Parallel executor service (by default the Common ForkJoinPool) see ThreadPools#setUseCommon
to change to a different 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 into two given a predicate.
|
default org.jooq.lambda.tuple.Tuple2<EagerFutureStream<U>,EagerFutureStream<U>> |
partitionFutureStream(java.util.function.Predicate<? super U> predicate)
Partition an EagerFutureStream into two EagerFutureStreams given a
predicate.
|
default EagerFutureStream<U> |
peek(java.util.function.Consumer<? super U> consumer)
Peek asynchronously at the results in the current stage.
|
static <T> EagerFutureStream<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> EagerFutureStream<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 <R> EagerFutureStream<R> |
retry(java.util.function.Function<U,R> fn)
Will execute this phase on the RetryExecutor (default or user supplied).
|
default EagerFutureStream<U> |
reverse()
Reverse a stream.
|
default EagerFutureStream<U> |
reverseFutures()
Reversed, operating on the underlying futures.
|
default <T> EagerFutureStream<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> EagerFutureStream<T> |
scanLeft(T seed,
java.util.function.BiFunction<T,? super U,T> function)
Scan a stream to the left.
|
default <R> EagerFutureStream<R> |
scanRight(R seed,
java.util.function.BiFunction<? super U,R,R> function)
Scan a stream to the right.
|
default EagerFutureStream<U> |
self(java.util.function.Consumer<FutureStream<U>> consumer)
Give a function access to the current stage of a SimpleReact Stream
|
default EagerFutureStream<U> |
sequential() |
default <K> java.util.Map<K,EagerFutureStream<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 EagerFutureStream<U> |
shuffle()
Shuffle a stream
|
default EagerFutureStream<U> |
shuffle(java.util.Random random)
Shuffle a stream using specified source of randomness
|
default EagerFutureStream<U> |
skip(long n) |
default EagerFutureStream<U> |
skipFutures(long n)
In contast to EagerFutureStream#skip skipFutures will skip the first n entries
of the underlying Stream of Futures.
|
default <T> FutureStream<U> |
skipUntil(EagerFutureStream<T> s)
Return a Stream with the same values as this Stream, but with all values omitted until the provided stream starts emitting values.
|
default EagerFutureStream<U> |
skipUntil(java.util.function.Predicate<? super U> predicate)
Returns a stream with all elements skipped for which a predicate
evaluates to false.
|
default EagerFutureStream<U> |
skipWhile(java.util.function.Predicate<? super U> predicate)
Returns a stream with all elements skipped for which a predicate
evaluates to true.
|
default EagerFutureStream<U> |
slice(long from,
long to)
Returns a limited interval from a given Stream.
|
default EagerFutureStream<U> |
sliceFutures(long from,
long to)
Returns a limited interval from a given Stream.
|
default EagerFutureStream<java.util.List<U>> |
sliding(int size)
Create a sliding view over this Stream
|
default EagerFutureStream<java.util.List<U>> |
sliding(int size,
int increment)
Create a sliding view over this Stream
|
default EagerFutureStream<U> |
sorted() |
default EagerFutureStream<U> |
sorted(java.util.Comparator<? super U> comparator) |
default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> |
splitAt(long position)
Split a EagerFutureStream at a given position.
|
default org.jooq.lambda.tuple.Tuple2<EagerFutureStream<U>,EagerFutureStream<U>> |
splitAtFutures(long position)
Split a stream at a given position.
|
default org.jooq.lambda.tuple.Tuple2<EagerFutureStream<U>,EagerFutureStream<U>> |
splitAtFutureStream(long position)
Split a EagerFutureStream at a given position.
|
default org.jooq.lambda.tuple.Tuple2<java.util.Optional<U>,org.jooq.lambda.Seq<U>> |
splitAtHead()
Split a stream at the head.
|
default org.jooq.lambda.tuple.Tuple2<java.util.Optional<U>,EagerFutureStream<U>> |
splitAtHeadFutureStream()
SplitAtHead but return type is EagerFutureStream
|
default java.util.stream.Stream<U> |
stream() |
default EagerFutureStream<U> |
sync() |
default <T> FutureStream<U> |
takeUntil(EagerFutureStream<T> s)
Return a Stream with the same values, but will stop emitting values once the provided Stream starts to emit values.
|
default <R> EagerFutureStream<R> |
then(java.util.function.Function<U,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> EagerFutureStream<R> |
then(java.util.function.Function<U,R> fn,
java.util.concurrent.Executor service) |
default <R> EagerFutureStream<R> |
thenSync(java.util.function.Function<U,R> fn) |
default Queue<U> |
toQueue()
Convert the current Stream to a SimpleReact Queue
|
default EagerFutureStream<U> |
unordered() |
EagerFutureStream<U> |
withAsync(boolean async) |
EagerFutureStream<U> |
withErrorHandler(java.util.Optional<java.util.function.Consumer<java.lang.Throwable>> errorHandler) |
EagerFutureStream<U> |
withLastActive(EagerStreamWrapper streamWrapper) |
default <T> FutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
withLatest(EagerFutureStream<T> s)
Similar to zip and combineLatest, except will always take the latest from this Stream while taking the last available value from the provided stream.
|
EagerFutureStream<U> |
withQueueFactory(QueueFactory<U> queue) |
EagerFutureStream<U> |
withRetrier(com.nurkiewicz.asyncretry.RetryExecutor retry) |
EagerFutureStream<U> |
withSubscription(Continueable sub) |
EagerFutureStream<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 <R> EagerFutureStream<org.jooq.lambda.tuple.Tuple2<U,R>> |
zip(org.jooq.lambda.Seq<R> other)
Zip two streams into one.
|
default <T,R> EagerFutureStream<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. |
default <R> EagerFutureStream<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> EagerFutureStream<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 EagerFutureStream<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 EagerFutureStream<org.jooq.lambda.tuple.Tuple2<U,java.lang.Long>> |
zipWithIndex()
Zip a Stream with a corresponding Stream of indexes.
|
allMatch, anyMatch, batchBySizeAndTime, batchByTime, cast, chunkLastReadIterator, collect, count, findAny, findFirst, firstValue, flatMapToDouble, flatMapToInt, flatMapToLong, forEach, forEachOrdered, futureOperations, futureOperations, getSubscription, getTaskExecutor, intersperse, isAsync, isParallel, iterator, lift, lift2, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, ofType, reduce, reduce, reduce, reversedIterator, single, slice, spliterator, toArray, toArray, toConcurrentLazyCollection, toLazyCollection
cast, concat, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, cycle, distinct, duplicate, foldLeft, foldLeft, foldRight, foldRight, generate, generate, generate, groupBy, groupBy, groupBy, groupBy, groupBy, groupBy, intersperse, isEmpty, isNotEmpty, iterate, join, join, join, join, join, join, limit, limitUntil, limitWhile, 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, 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, zip, zip, zipWithIndex
assureSimpleReactException, bind, block, block, convertToEagerStream, copySimpleReactStream, doOnEachSync, filterSync, fromStreamCompletableFutureReplace, getSubscription, handleExceptions, join, lastActiveArray, merge, peekSync, streamCompletableFutures, with
getQueueFactory, getSimpleReact, simpleReactStream, simpleReactStream, simpleReactStream, simpleReactStream, simpleReactStreamFrom, simpleReactStreamFromIterable
block, block, blockAndExtract, blockAndExtract, first, getErrorHandler, last
getErrorHandler, getRetrier, getSimpleReact, getTaskExecutor, isAsync
addToQueue, getQueueFactory, toQueue, toQueue
EagerStreamWrapper getLastActive()
getLastActive
in interface BlockingStream<U>
getLastActive
in interface EagerSimpleReactStream<U>
getLastActive
in interface FutureStream<U>
getLastActive
in interface SimpleReactStream<U>
default Queue<U> toQueue()
EagerToQueue
toQueue
in interface EagerToQueue<U>
toQueue
in interface SimpleReactStream<U>
toQueue
in interface ToQueue<U>
EagerFutureStream<U> withAsync(boolean async)
withAsync
in interface ConfigurableStream<U,java.util.concurrent.CompletableFuture<U>>
withAsync
in interface EagerSimpleReactStream<U>
EagerFutureStream<U> withTaskExecutor(java.util.concurrent.Executor e)
withTaskExecutor
in interface ConfigurableStream<U,java.util.concurrent.CompletableFuture<U>>
withTaskExecutor
in interface EagerSimpleReactStream<U>
EagerFutureStream<U> withRetrier(com.nurkiewicz.asyncretry.RetryExecutor retry)
withRetrier
in interface ConfigurableStream<U,java.util.concurrent.CompletableFuture<U>>
withRetrier
in interface EagerSimpleReactStream<U>
withRetrier
in interface SimpleReactStream<U>
EagerFutureStream<U> withQueueFactory(QueueFactory<U> queue)
withQueueFactory
in interface ConfigurableStream<U,java.util.concurrent.CompletableFuture<U>>
withQueueFactory
in interface EagerSimpleReactStream<U>
withQueueFactory
in interface FutureStream<U>
withQueueFactory
in interface SimpleReactStream<U>
EagerFutureStream<U> withErrorHandler(java.util.Optional<java.util.function.Consumer<java.lang.Throwable>> errorHandler)
withErrorHandler
in interface ConfigurableStream<U,java.util.concurrent.CompletableFuture<U>>
withErrorHandler
in interface EagerSimpleReactStream<U>
EagerFutureStream<U> withSubscription(Continueable sub)
withSubscription
in interface ConfigurableStream<U,java.util.concurrent.CompletableFuture<U>>
withSubscription
in interface EagerSimpleReactStream<U>
withSubscription
in interface SimpleReactStream<U>
default <R> EagerFutureStream<R> thenSync(java.util.function.Function<U,R> fn)
thenSync
in interface EagerSimpleReactStream<U>
thenSync
in interface EagerToQueue<U>
thenSync
in interface SimpleReactStream<U>
default EagerFutureStream<U> sync()
sync
in interface EagerSimpleReactStream<U>
sync
in interface FutureStream<U>
sync
in interface SimpleReactStream<U>
default EagerFutureStream<U> async()
async
in interface EagerSimpleReactStream<U>
async
in interface FutureStream<U>
async
in interface SimpleReactStream<U>
default LazyFutureStream<U> convertToLazyStream()
default <R> EagerFutureStream<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 EagerFutureStream<java.util.Collection<U>> chunkSinceLastRead()
chunkSinceLastRead
in interface FutureStream<U>
default <K> java.util.Map<K,EagerFutureStream<U>> shard(java.util.Map<K,Queue<U>> shards, java.util.function.Function<U,K> sharder)
Queue<Integer> evenQueue = QueueFactories.unboundedQueue().build();
Queue<Integer> oddQueue = QueueFactories.unboundedQueue().build()
EagerFutureStream.of(10,20,25,30,41,43)
.shard(ImmutableMap.of("even",evenQueue,"odd",oddQueue),element-> element==0? "even" : "odd");
Stream<Integer> evenStream = evenQueue.stream();
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 void cancel()
cancel
in interface FutureStream<U>
default EagerFutureStream<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 time
{@code
EagerFutureStream.of(1,2,3,4,5,6)
.debounce(1000,TimeUnit.SECONDS)
.toList();
//[1] - as all events will be passed through in < 1000 seconds, only 1 will be allowed
}
default EagerFutureStream<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 EagerFutureStream<java.util.List<U>> batchBySizeAndTime(int batchSize, long time, java.util.concurrent.TimeUnit unit)
FutureStream
batchBySizeAndTime
in interface FutureStream<U>
default EagerFutureStream<java.util.Collection<U>> batchByTime(long time, java.util.concurrent.TimeUnit unit)
batchByTime
in interface FutureStream<U>
time
- Time period during which all elements should be collectedunit
- Time unit during which all elements should be collectedWill always include the next value over the batch time in current batch (again @see LazyFutureStream#batchByTime(long, TimeUnit)
for a more powerful alternative that does not).
default <C extends java.util.Collection<U>> EagerFutureStream<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 EagerFutureStream<java.util.List<U>> batchBySize(int size)
EagerFutureStream.of(1,2,3,4,5,6)
.batchBySize(3)
.toList();
// [[1,2,3],[4,5,6]]
batchBySize
in interface FutureStream<U>
size
- Size of lists elements should be batched intodefault <C extends java.util.Collection<U>> EagerFutureStream<C> batchBySize(int size, java.util.function.Supplier<C> supplier)
EagerFutureStream.of(1,1,1,1,1,1)
.batchBySize(3,()->new TreeSet<>())
.toList()
//[[1],[1]]
batchBySize
in interface FutureStream<U>
size
- Size of batchsupplier
- Create the batch holding collectiondefault EagerFutureStream<U> jitter(long jitterInNanos)
EagerFutureStream.parallelCommonBuilder()
.of(IntStream.range(0, 100))
.map(it -> it*100)
.jitter(10l)
.peek(System.out::println)
.block();
jitter
in interface FutureStream<U>
jitterInNanos
- Max number of nanos for jitter (random number less than this
will be selected)/default EagerFutureStream<U> fixedDelay(long time, java.util.concurrent.TimeUnit unit)
EagerFutureStream.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 FutureStream<U>
time
- amount of time between emissionsunit
- TimeUnit for emissionsdefault EagerFutureStream<U> onePer(long time, java.util.concurrent.TimeUnit unit)
EagerFutureStream.of(1,2,3,4,5,6)
.onePer(1000,TimeUnit.NANOSECONDS)
.toList();
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)
EagerFutureStream.of(1,2,3,4,5,6)
.xPer(6,100000000,TimeUnit.NANOSECONDS)
.toList();
xPer
in interface FutureStream<U>
x
- Number of allowable emissions per time periodtime
- Frequency time periodunit
- Frequency time unitdefault <T> FutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> withLatest(EagerFutureStream<T> s)
s
- Stream to merge withdefault <T> FutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> combineLatest(EagerSimpleReactStream<T> s)
s
- Stream to merge withdefault <T> FutureStream<U> skipUntil(EagerFutureStream<T> s)
s
- Stream that will start the emission of values from this streamdefault <T> FutureStream<U> takeUntil(EagerFutureStream<T> s)
s
- Stream that will stop the emission of values from this streamstatic <U> EagerFutureStream<U> firstOf(EagerFutureStream<U>... futureStreams)
EagerFutureStream.firstOf(stream1, stream2, stream3)
.peek(System.out::println)
.map(this::saveData)
.block();
futureStreams
- Streams to racedefault <R> EagerFutureStream<R> then(java.util.function.Function<U,R> fn, java.util.concurrent.Executor service)
then
in interface EagerSimpleReactStream<U>
then
in interface SimpleReactStream<U>
default EagerFutureStream<U> doOnEach(java.util.function.Function<U,U> fn)
doOnEach
in interface EagerSimpleReactStream<U>
doOnEach
in interface SimpleReactStream<U>
fn
- Function to be applied to each completablefuture on completiondefault <R> EagerFutureStream<R> then(java.util.function.Function<U,R> fn)
SimpleReactStream
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 EagerSimpleReactStream<U>
then
in interface SimpleReactStream<U>
fn
- Function to be applied to the results of the currently active
event tasksdefault java.util.List<EagerFutureStream<U>> copy(int times)
default EagerFutureStream<U> merge(EagerSimpleReactStream<U>... streams)
merge
in interface EagerSimpleReactStream<U>
static <R> EagerFutureStream<R> mergeMultiple(EagerFutureStream... s)
s
- Streams to mergedefault EagerFutureStream<U> onFail(java.util.function.Function<SimpleReactFailedStageException,U> fn)
SimpleReactStream
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 EagerSimpleReactStream<U>
onFail
in interface FutureStream<U>
onFail
in interface SimpleReactStream<U>
fn
- Recovery function, the exception is input, and the recovery
value is outputdefault EagerFutureStream<U> onFail(java.lang.Class<? extends java.lang.Throwable> exceptionClass, java.util.function.Function<SimpleReactFailedStageException,U> fn)
SimpleReactStream
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 EagerSimpleReactStream<U>
onFail
in interface SimpleReactStream<U>
exceptionClass
- Class of exceptions to recover fromfn
- Recovery functiondefault EagerFutureStream<U> capture(java.util.function.Consumer<? extends java.lang.Throwable> errorHandler)
SimpleReactStream
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 EagerSimpleReactStream<U>
capture
in interface FutureStream<U>
capture
in interface SimpleReactStream<U>
errorHandler
- A consumer that recieves and deals with an unrecoverable error
in the dataflowdefault <T,R> EagerFutureStream<R> allOf(java.util.function.Function<java.util.List<T>,R> fn)
EagerSimpleReactStream
boolean blocked[] = {false};
new SimpleReact().<Integer, Integer> react(() -> 1, () -> 2, () -> 3)
.then(it -> {
try {
Thread.sleep(50000);
} catch (Exception e) {
}
blocked[0] =true;
return 10;
})
.allOf( it -> it.size());
assertThat(blocked[0],is(false));
In this example, the current thread will continue and assert that it is
not blocked, allOf could continue and be executed in a separate thread.allOf
in interface EagerSimpleReactStream<U>
fn
- Function that recieves the results of all currently active
tasks as inputdefault EagerFutureStream<U> peek(java.util.function.Consumer<? super U> consumer)
SimpleReactStream
peek
in interface EagerSimpleReactStream<U>
peek
in interface FutureStream<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 EagerFutureStream<U> filter(java.util.function.Predicate<? super U> p)
SimpleReactStream
filter
in interface EagerSimpleReactStream<U>
filter
in interface FutureStream<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> EagerFutureStream<R> flatMap(java.util.function.Function<? super U,? extends java.util.stream.Stream<? extends R>> flatFn)
SimpleReactStream
flatMap
in interface EagerSimpleReactStream<U>
flatMap
in interface FutureStream<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> EagerFutureStream<R> flatMapCompletableFuture(java.util.function.Function<U,java.util.concurrent.CompletableFuture<R>> flatFn)
assertThat( new EagerReact()
.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 EagerSimpleReactStream<U>
flatMapCompletableFuture
in interface SimpleReactStream<U>
flatFn
- flatMap functiondefault <R> EagerFutureStream<R> flatMapCompletableFutureSync(java.util.function.Function<U,java.util.concurrent.CompletableFuture<R>> flatFn)
assertThat( new EagerReact()
.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 EagerSimpleReactStream<U>
flatMapCompletableFutureSync
in interface SimpleReactStream<U>
flatFn
- flatMap functiondefault <R> EagerFutureStream<R> retry(java.util.function.Function<U,R> fn)
SimpleReactStream
retry
in interface EagerSimpleReactStream<U>
retry
in interface SimpleReactStream<U>
fn
- Function that will be executed and retried on failuredefault <T,R> EagerFutureStream<R> allOf(java.util.stream.Collector collector, java.util.function.Function<T,R> fn)
allOf
in interface EagerSimpleReactStream<U>
allOf
in interface EagerToQueue<U>
collector
- to perform aggregation / reduction operation on the results
from active stage (e.g. to Collect into a List or String)fn
- Function that receives the results of all currently active
tasks as inputdefault <R> EagerFutureStream<R> anyOf(java.util.function.Function<U,R> fn)
EagerSimpleReactStream
anyOf
in interface EagerSimpleReactStream<U>
fn
- Function to apply when any of the previous events completeEagerFutureStream<U> withLastActive(EagerStreamWrapper streamWrapper)
withLastActive
in interface EagerSimpleReactStream<U>
default <R> EagerFutureStream<R> fromStream(java.util.stream.Stream<R> stream)
fromStream
in interface EagerSimpleReactStream<U>
fromStream
in interface FutureStream<U>
fromStream
in interface SimpleReactStream<U>
default <R> EagerFutureStream<R> fromStreamOfFutures(java.util.stream.Stream<java.util.concurrent.CompletableFuture<R>> stream)
EagerSimpleReactStream
fromStreamOfFutures
in interface EagerSimpleReactStream<U>
stream
- JDK Stream to construct new SimpleReactStream fromdefault EagerFutureStream<U> limit(long maxSize)
default EagerFutureStream<U> limitFutures(long maxSize)
EagerFutureStream.of(()>loadSlow(),()>loadMedium(),()>loadFast())
.limitFutures(2)
//[loadSlow, loadMedium]
maxSize
- The size of the subsequent Streamdefault EagerFutureStream<U> skip(long n)
default EagerFutureStream<U> skipFutures(long n)
EagerFutureStream.of(()>loadSlow(),()>loadMedium(),()>loadFast())
.skip(2)
//[loadFast]
n
- default <U> EagerFutureStream<U> cast(java.lang.Class<U> type)
cast
in interface FutureStream<U>
cast
in interface org.jooq.lambda.Seq<U>
default <U> EagerFutureStream<U> ofType(java.lang.Class<U> type)
EagerFutureStream.of(1, "a", 2, "b", 3).ofType(Integer.class) gives a Stream of (1,2,3) EagerFutureStream.of(1, "a", 2, "b", 3).ofType(String.class) gives a Stream of ("a","b")
ofType
in interface FutureStream<U>
ofType
in interface org.jooq.lambda.Seq<U>
FutureStream.ofType(java.lang.Class)
default EagerFutureStream<U> concat(java.util.stream.Stream<U> other)
// (1, 2, 3, 4, 5, 6)
EagerFutureStream.of(1, 2,3).concat(Stream.of(4, 5, 6))
concat
in interface org.jooq.lambda.Seq<U>
Seq.concat(Stream[])
default EagerFutureStream<U> concat(U other)
// (1, 2, 3, 4) EagerFutureStream.of(1, 2, 3).concat(4)
concat
in interface org.jooq.lambda.Seq<U>
Seq.concat(Stream[])
default EagerFutureStream<U> concat(U... other)
// (1, 2, 3, 4, 5, 6) EagerFutureStream.of(1, 2, 3).concat(4, 5, 6)
concat
in interface org.jooq.lambda.Seq<U>
Seq.concat(Stream[])
default EagerFutureStream<U> sliceFutures(long from, long to)
// (4, 5) EagerFutureStream.of(1, 2, 3, 4, 5, 6).sliceFutures(3, 5)
slice(long, long)
default EagerFutureStream<U> slice(long from, long to)
// (4, 5) EagerFutureStream.of(1, 2, 3, 4, 5, 6).slice(3, 5)
slice
in interface FutureStream<U>
slice
in interface org.jooq.lambda.Seq<U>
Seq.slice(Stream, long, long)
default <R> EagerFutureStream<org.jooq.lambda.tuple.Tuple2<U,R>> zip(org.jooq.lambda.Seq<R> other)
// (tuple(1, "a"), tuple(2, "b"), tuple(3, "c")) EagerFutureStream.of(1,
2, 3).zip(EagerFutureStream.of("a", "b", "c"))
zip
in interface org.jooq.lambda.Seq<U>
Seq.zip(Stream, Stream)
default <T,R> EagerFutureStream<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")
EagerFutureStream.of(1, 2,3).zip(EagerFutureStream.of("a", "b", "c"), (i, s) > i + ":" + s)
zip
in interface org.jooq.lambda.Seq<U>
zip(Seq, BiFunction)
default <R> EagerFutureStream<org.jooq.lambda.tuple.Tuple2<U,R>> zipFutures(java.util.stream.Stream<R> other)
zipFutures
in interface FutureStream<U>
other
- default <R> EagerFutureStream<org.jooq.lambda.tuple.Tuple2<U,R>> zipFutures(FutureStream<R> other)
zipFutures
in interface FutureStream<U>
other
- Another FutureStream to zip Futures withdefault EagerFutureStream<org.jooq.lambda.tuple.Tuple2<U,java.lang.Long>> zipFuturesWithIndex()
EagerFutureStream.react(()->takesALotOfTime(),()->veryQuick()).zipWithIndex();
[["takesALotOfTime",0],["veryQuick",1]]
Where as with standard zipWithIndex you would get a new Stream ordered by completion
[["veryQuick",0],["takesALotOfTime",1]]
Seq.zipWithIndex(Stream)
default EagerFutureStream<org.jooq.lambda.tuple.Tuple2<U,java.lang.Long>> zipWithIndex()
// (tuple("a", 0), tuple("b", 1), tuple("c", 2))
EagerFutureStream.of("a", "b", "c").zipWithIndex()
zipWithIndex
in interface org.jooq.lambda.Seq<U>
Seq.zipWithIndex(Stream)
default <T> EagerFutureStream<T> scanLeft(T seed, java.util.function.BiFunction<T,? super U,T> function)
// ("", "a", "ab", "abc") EagerFutureStream.of("a", "b",
"c").scanLeft("", (u, t) > u + t)
scanLeft
in interface org.jooq.lambda.Seq<U>
default <R> EagerFutureStream<R> scanRight(R seed, java.util.function.BiFunction<? super U,R,R> function)
// ("", "c", "cb", "cba") EagerFutureStream.of("a", "b",
"c").scanRight("", (t, u) > u + t)
scanRight
in interface org.jooq.lambda.Seq<U>
default EagerFutureStream<U> reverse()
// (3, 2, 1) EagerFutureStream.of(1, 2, 3).reverse()
reverse
in interface FutureStream<U>
reverse
in interface org.jooq.lambda.Seq<U>
default EagerFutureStream<U> reverseFutures()
// (3, 2, 1) EagerFutureStream.of(1, 2, 3).reverse()
default EagerFutureStream<U> shuffle()
// e.g. (2, 3, 1) EagerFutureStream.of(1, 2, 3).shuffle()
shuffle
in interface org.jooq.lambda.Seq<U>
default EagerFutureStream<U> shuffle(java.util.Random random)
// e.g. (2, 3, 1) EagerFutureStream.of(1, 2, 3).shuffle(new Random())
shuffle
in interface org.jooq.lambda.Seq<U>
default EagerFutureStream<U> skipWhile(java.util.function.Predicate<? super U> predicate)
// (3, 4, 5) EagerFutureStream.of(1, 2, 3, 4, 5).skipWhile(i > i <
3)
skipWhile
in interface org.jooq.lambda.Seq<U>
Seq.skipWhile(Stream, Predicate)
default EagerFutureStream<U> skipUntil(java.util.function.Predicate<? super U> predicate)
// (3, 4, 5) EagerFutureStream.of(1, 2, 3, 4, 5).skipUntil(i > i == 3)
skipUntil
in interface org.jooq.lambda.Seq<U>
Seq.skipUntil(Stream, Predicate)
default EagerFutureStream<U> limitWhile(java.util.function.Predicate<? super U> predicate)
// (1, 2) EagerFutureStream.of(1, 2, 3, 4, 5).limitWhile(i -> i <
3)
limitWhile
in interface org.jooq.lambda.Seq<U>
Seq.limitWhile(Stream, Predicate)
default EagerFutureStream<U> limitUntil(java.util.function.Predicate<? super U> predicate)
// (1, 2) EagerFutureStream.of(1, 2, 3, 4, 5).limitUntil(i > i == 3)
limitUntil
in interface org.jooq.lambda.Seq<U>
Seq.limitUntil(Stream, Predicate)
default <T> EagerFutureStream<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 EagerFutureStream<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 EagerFutureStream<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> EagerFutureStream<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> EagerFutureStream<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))
EagerFutureStream.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> EagerFutureStream<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))
EagerFutureStream.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> EagerFutureStream<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))
EagerFutureStream.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 EagerFutureStream<U> intersperse(U value)
// (1, 0, 2, 0, 3, 0, 4) EagerFutureStream.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 EagerFutureStream<U> distinct()
default EagerFutureStream<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 EagerFutureStream<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<EagerFutureStream<U>,EagerFutureStream<U>> duplicateFutures()
EagerFutureStream.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!duplicate()
default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> duplicate()
EagerFutureStream.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!duplicate
in interface org.jooq.lambda.Seq<U>
duplicate()
default EagerFutureStream<U> cycle()
cycle
in interface org.jooq.lambda.Seq<U>
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))
EagerFutureStream.of(1, 2, 3, 4, 5,6).partition(i -> i % 2 != 0)
partition
in interface org.jooq.lambda.Seq<U>
Seq.partition(Stream, Predicate)
default org.jooq.lambda.tuple.Tuple2<EagerFutureStream<U>,EagerFutureStream<U>> partitionFutureStream(java.util.function.Predicate<? super U> predicate)
EagerFutureStream.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 org.jooq.lambda.tuple.Tuple2<EagerFutureStream<U>,EagerFutureStream<U>> splitAtFutures(long position)
// tuple((1, 2, 3), (4, 5, 6))
EagerFutureStream.of(1, 2, 3, 4, 5,6).splitAt(3)
Seq.splitAt(Stream, long)
default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> splitAt(long position)
EagerFutureStream.of(1, 2, 3, 4, 5, 6).splitAt(3)
results in tuple((1, 2, 3), (4, 5, 6))
splitAt
in interface org.jooq.lambda.Seq<U>
splitAt(long)
default org.jooq.lambda.tuple.Tuple2<EagerFutureStream<U>,EagerFutureStream<U>> splitAtFutureStream(long position)
EagerFutureStream.of(1, 2, 3, 4, 5, 6).splitAtFutureStream(3)
results in tuple((1, 2, 3), (4, 5, 6))
splitAt(long)
default <R> EagerFutureStream<R> fromListCompletableFuture(java.util.List<java.util.concurrent.CompletableFuture<R>> list)
fromListCompletableFuture
in interface EagerSimpleReactStream<U>
default org.jooq.lambda.tuple.Tuple2<java.util.Optional<U>,org.jooq.lambda.Seq<U>> splitAtHead()
// tuple(1, (2, 3, 4, 5, 6))
EagerFutureStream.of(1, 2, 3, 4, 5, 6).splitHead(3)
splitAtHead
in interface org.jooq.lambda.Seq<U>
Seq.splitAt(Stream, long)
default org.jooq.lambda.tuple.Tuple2<java.util.Optional<U>,EagerFutureStream<U>> splitAtHeadFutureStream()
splitAtHead()
default void close()
default java.util.stream.Stream<U> stream()
stream
in interface FutureStream<U>
stream
in interface org.jooq.lambda.Seq<U>
default EagerFutureStream<U> parallel()
default EagerFutureStream<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 EagerFutureStream<U> unordered()
default EagerFutureStream<U> onClose(java.lang.Runnable closeHandler)
default EagerFutureStream<U> sorted()
sorted
in interface FutureStream<U>
sorted
in interface org.jooq.lambda.Seq<U>
sorted
in interface java.util.stream.Stream<U>
default EagerFutureStream<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 EagerFutureStream<U> self(java.util.function.Consumer<FutureStream<U>> consumer)
self
in interface FutureStream<U>
consumer
- Consumer that will recieve current stagestatic <U> EagerFutureStream<U> parallel(U... array)
parallel
in interface SimpleReactStream<U>
array
- Values to react tostatic <T> EagerFutureStream<T> eagerFutureStreamFrom(java.util.stream.Stream<java.util.concurrent.CompletableFuture<T>> stream)
Stream.of(Object)
static <T> EagerFutureStream<T> eagerFutureStream(java.util.concurrent.CompletableFuture<T> value)
Stream.of(Object)
static <T> EagerFutureStream<T> eagerFutureStream(java.util.concurrent.CompletableFuture<T>... values)
Stream.of(Object)
static <T> EagerFutureStream<T> react(java.util.function.Supplier<T> value)
react
in interface SimpleReactStream<U>
Stream.of(Object)
@SafeVarargs static <T> EagerFutureStream<T> react(java.util.function.Supplier<T>... values)
react
in interface SimpleReactStream<U>
Stream.of(Object[])
static <T> EagerFutureStream<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>
Stream.of(Object)
@SafeVarargs static <T> EagerFutureStream<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>
Stream.of(Object[])
static <T> EagerFutureStream<T> ofThread(T value)
ofThread
in interface SimpleReactStream<U>
Stream.of(Object)
@SafeVarargs static <T> EagerFutureStream<T> ofThread(T... values)
ofThread
in interface SimpleReactStream<U>
Stream.of(Object[])
static <T> EagerFutureStream<T> empty()
SimpleReactStream
empty
in interface org.jooq.lambda.Seq<U>
empty
in interface SimpleReactStream<U>
empty
in interface java.util.stream.Stream<U>
Stream.empty()
static <T> EagerFutureStream<T> eagerFutureStream(java.util.stream.Stream<T> stream)
static <T> EagerFutureStream<T> eagerFutureStreamFromIterable(java.lang.Iterable<T> iterable)
static <T> EagerFutureStream<T> eagerFutureStream(java.util.Iterator<T> iterator)