public interface LazyFutureStream<U> extends LazySimpleReactStream<U>, LazyStream<U>, com.aol.cyclops.sequence.SequenceM<U>, org.jooq.lambda.Seq<U>, LazyToQueue<U>, ConfigurableStream<U,FastFuture<U>>, FutureStreamAsyncPublisher<U>, FutureStreamSynchronousPublisher<U>
Modifier and Type | Method and Description |
---|---|
default OperationsOnFutures<U> |
actOnFutures()
LazyFutureStream operators act on the results of the previous stage by default.
|
default boolean |
allMatch(java.util.function.Predicate<? super U> c) |
default com.aol.cyclops.monad.AnyM<U> |
anyM() |
default boolean |
anyMatch(java.util.function.Predicate<? super U> c) |
default LazyFutureStream<U> |
append(U... values) |
default LazyFutureStream<U> |
appendStream(java.util.stream.Stream<U> stream) |
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) |
default <C extends java.util.Collection<U>> |
batchBySizeAndTime(int size,
long time,
java.util.concurrent.TimeUnit unit,
java.util.function.Supplier<C> factory) |
default LazyFutureStream<java.util.List<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 <C extends java.util.Collection<U>> |
batchByTime(long time,
java.util.concurrent.TimeUnit unit,
java.util.function.Supplier<C> factory)
Organise elements in a Stream into a Collections based on the time period
they pass through this stage
|
default LazyFutureStream<java.util.List<U>> |
batchUntil(java.util.function.Predicate<U> predicate) |
default <C extends java.util.Collection<U>> |
batchUntil(java.util.function.Predicate<U> predicate,
java.util.function.Supplier<C> factory) |
default LazyFutureStream<java.util.List<U>> |
batchWhile(java.util.function.Predicate<U> predicate) |
default <C extends java.util.Collection<U>> |
batchWhile(java.util.function.Predicate<U> predicate,
java.util.function.Supplier<C> factory) |
default LazyFutureStream<U> |
boundedWaitFree(int size)
Use an Agrona ManyToOneConcurrentArrayQueue for the next operations (wait-free, mechanical sympathy).
|
default LazyFutureStream<U> |
capture(java.util.function.Consumer<? 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) |
default java.util.Iterator<java.util.Collection<U>> |
chunkLastReadIterator() |
default LazyFutureStream<java.util.Collection<U>> |
chunkSinceLastRead() |
default void |
closeAll()
closes all open queues.
|
default <R> R |
collect(java.util.function.Supplier<R> supplier,
java.util.function.BiConsumer<R,? super U> accumulator,
java.util.function.BiConsumer<R,R> combiner) |
default <R> java.util.List<R> |
collectIterable(java.lang.Iterable<java.util.stream.Collector> collectors) |
default java.util.List |
collectStream(java.util.stream.Stream<java.util.stream.Collector> collectors) |
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 SimpleReactStream<U> |
convertToSimpleReact()
Convert between an Lazy and Eager SimpleReact Stream,
can be used to take advantages of each approach during a single Stream
Allows callers to take advantage of functionality only available in SimpleReactStreams such as allOf
|
default java.util.List<LazyFutureStream<U>> |
copy(int times)
Copy this Stream the specified number of times
|
default long |
count() |
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
crossJoin(java.util.stream.Stream<T> other)
Cross join 2 streams into one.
|
default LazyFutureStream<U> |
cycle()
Create a Stream that infinitely cycles this Stream
|
default <R> LazyFutureStream<R> |
cycle(java.lang.Class<R> monadC,
int times) |
default LazyFutureStream<U> |
cycle(int times)
Create a Stream that finitely cycles this Stream, provided number of times
|
default LazyFutureStream<U> |
cycle(com.aol.cyclops.sequence.Monoid<U> m,
int times) |
default LazyFutureStream<U> |
cycleUntil(java.util.function.Predicate<? super U> predicate)
Repeat in a Stream until specified predicate holds
|
default LazyFutureStream<U> |
cycleWhile(java.util.function.Predicate<? super U> predicate)
Repeat in a Stream while specified predicate holds
|
default LazyFutureStream<U> |
debounce(long time,
java.util.concurrent.TimeUnit unit)
Can be used to debounce (accept a single data point from a unit of time)
data.
|
default LazyFutureStream<U> |
deleteBetween(int start,
int end) |
default LazyFutureStream<U> |
distinct() |
default <R> com.aol.cyclops.sequence.SequenceM<U> |
distinct(java.util.function.Function<? super U,? extends R> keyExtractor) |
default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> |
duplicate()
Duplicate a LazyFutureStream into two equivalent Streams.
|
default org.jooq.lambda.tuple.Tuple2<LazyFutureStream<U>,LazyFutureStream<U>> |
duplicateFutureStream() |
default org.jooq.lambda.tuple.Tuple2<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> |
duplicateSequence() |
static <T> LazyFutureStream<T> |
empty()
Create a sequential synchronous stream that runs on the current thread
|
default boolean |
endsWith(java.lang.Iterable<U> iterable) |
default boolean |
endsWith(java.util.stream.Stream<U> stream) |
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> |
findAny() |
default java.util.Optional<U> |
findFirst() |
default U |
firstValue() |
default LazyFutureStream<U> |
fixedDelay(long time,
java.util.concurrent.TimeUnit unit)
Apply a fixed delay before emitting elements to the next phase of the
Stream.
|
default <R> LazyFutureStream<R> |
flatMap(java.util.function.Function<? super U,? extends java.util.stream.Stream<? extends R>> flatFn)
Allows aggregate values in a Stream to be flatten into a single Stream.
|
default <R> LazyFutureStream<R> |
flatMapAnyM(java.util.function.Function<? super U,com.aol.cyclops.monad.AnyM<? extends R>> fn) |
default LazyFutureStream<java.lang.String> |
flatMapBufferedReader(java.util.function.Function<? super U,java.io.BufferedReader> fn) |
default LazyFutureStream<java.lang.Character> |
flatMapCharSequence(java.util.function.Function<? super U,java.lang.CharSequence> fn) |
default <R> LazyFutureStream<R> |
flatMapCollection(java.util.function.Function<? super U,java.util.Collection<? extends R>> fn) |
default <R> LazyFutureStream<R> |
flatMapCompletableFuture(java.util.function.Function<? super U,java.util.concurrent.CompletableFuture<? extends R>> flatFn)
Perform a flatMap operation where the CompletableFuture type returned is flattened from the resulting Stream
If in async mode this operation is performed asyncrhonously
If in sync mode this operation is performed synchronously
|
default LazyFutureStream<java.lang.String> |
flatMapFile(java.util.function.Function<? super U,java.io.File> fn) |
default <R> LazyFutureStream<R> |
flatMapOptional(java.util.function.Function<? super U,java.util.Optional<? extends R>> fn) |
default <R> LazyFutureStream<R> |
flatMapStream(java.util.function.Function<? super U,java.util.stream.BaseStream<? extends R,?>> fn) |
default <R> LazyFutureStream<R> |
flatMapToCompletableFutureSync(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 java.util.stream.DoubleStream |
flatMapToDouble(java.util.function.Function<? super U,? extends java.util.stream.DoubleStream> mapper) |
default java.util.stream.IntStream |
flatMapToInt(java.util.function.Function<? super U,? extends java.util.stream.IntStream> mapper) |
default java.util.stream.LongStream |
flatMapToLong(java.util.function.Function<? super U,? extends java.util.stream.LongStream> mapper) |
default LazyFutureStream<java.lang.String> |
flatMapURL(java.util.function.Function<? super U,java.net.URL> fn) |
default <T1> LazyFutureStream<T1> |
flatten() |
default U |
foldLeft(com.aol.cyclops.sequence.Monoid<U> reducer) |
default U |
foldLeft(U identity,
java.util.function.BinaryOperator<U> accumulator) |
default <T> T |
foldLeftMapToType(com.aol.cyclops.sequence.Monoid<T> reducer) |
default U |
foldRight(com.aol.cyclops.sequence.Monoid<U> reducer) |
default U |
foldRight(U identity,
java.util.function.BinaryOperator<U> accumulator) |
default <T> T |
foldRightMapToType(com.aol.cyclops.sequence.Monoid<T> reducer) |
default void |
forEach(java.util.function.Consumer<? super U> c) |
default void |
forEachOrdered(java.util.function.Consumer<? super U> action) |
static <T> LazyFutureStream<T> |
freeThread(T... values)
Create a sequential synchronous stream that runs on a free thread (commonFreeThread executor by default, shared
across any instances created in this manner.
|
static <T> LazyFutureStream<T> |
freeThread(T value)
Create a sequential synchronous stream that runs on a free thread (commonFreeThread executor by default, shared
across any instances created in this manner.
|
default <R> LazyFutureStream<R> |
fromStream(java.util.stream.Stream<R> stream) |
default <R> LazyFutureStream<R> |
fromStreamOfFutures(java.util.stream.Stream<FastFuture<R>> stream) |
default com.aol.cyclops.sequence.future.FutureOperations<U> |
futureOperations() |
default com.aol.cyclops.sequence.future.FutureOperations<U> |
futureOperations(java.util.concurrent.Executor exec) |
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 <K> java.util.Map<K,java.util.List<U>> |
groupBy(java.util.function.Function<? super U,? extends K> classifier) |
default LazyFutureStream<java.util.List<U>> |
grouped(int groupSize) |
default com.aol.cyclops.sequence.HeadAndTail<U> |
headAndTail() |
default java.util.Optional<com.aol.cyclops.sequence.HeadAndTail<U>> |
headAndTailOptional() |
default com.aol.cyclops.sequence.HotStream<U> |
hotStream()
Turns this LazyFutureStream into a HotStream, a connectable Stream, being executed on a thread on the
in it's current task executor, that is producing data
|
default com.aol.cyclops.sequence.HotStream<U> |
hotStream(java.util.concurrent.Executor e) |
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> |
insertAt(int pos,
U... values) |
default LazyFutureStream<U> |
insertStreamAt(int pos,
java.util.stream.Stream<U> stream) |
default LazyFutureStream<U> |
intersperse(U value)
Returns a stream with a given value interspersed between any two values
of this stream.
|
default boolean |
isParallel() |
static <T> LazyFutureStream<T> |
iterate(T seed,
java.util.function.UnaryOperator<T> f) |
default CloseableIterator<U> |
iterator() |
default LazyFutureStream<U> |
jitter(long jitterInNanos)
Introduce a random delay between events in a stream Can be used to
prevent behaviour synchronizing within a system
|
default java.lang.String |
join() |
default java.lang.String |
join(java.lang.String sep) |
default java.lang.String |
join(java.lang.String sep,
java.lang.String start,
java.lang.String end) |
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> |
limit(long time,
java.util.concurrent.TimeUnit unit) |
default LazyFutureStream<U> |
limitLast(int num) |
default LazyFutureStream<U> |
limitUntil(java.util.function.Predicate<? super U> predicate)
Returns a stream limited to all elements for which a predicate evaluates
to false.
|
default LazyFutureStream<U> |
limitWhile(java.util.function.Predicate<? super U> predicate)
Returns a stream limited to all elements for which a predicate evaluates
to true.
|
default <R> LazyFutureStream<R> |
map(java.util.function.Function<? super U,? extends R> mapper) |
default <R> R |
mapReduce(java.util.function.Function<? super U,? extends R> mapper,
com.aol.cyclops.sequence.Monoid<R> reducer) |
default <R> R |
mapReduce(com.aol.cyclops.sequence.Monoid<R> reducer) |
default java.util.stream.DoubleStream |
mapToDouble(java.util.function.ToDoubleFunction<? super U> mapper) |
default java.util.stream.IntStream |
mapToInt(java.util.function.ToIntFunction<? super U> mapper) |
default java.util.stream.LongStream |
mapToLong(java.util.function.ToLongFunction<? super U> mapper) |
default java.util.Optional<U> |
max(java.util.Comparator<? super U> comparator) |
default LazyFutureStream<U> |
maxActive(int concurrentTasks)
Configure the max active concurrent tasks.
|
default <C extends java.lang.Comparable<C>> |
maxBy(java.util.function.Function<U,C> f) |
default <R> LazyFutureStream<R> |
mergeLatest(LazyFutureStream<?>... streams)
Merges this stream and the supplied Streams into a single Stream where the next value
is the next returned across any of the involved Streams.
|
default java.util.Optional<U> |
min(java.util.Comparator<? super U> comparator) |
default <C extends java.lang.Comparable<C>> |
minBy(java.util.function.Function<U,C> f) |
default boolean |
noneMatch(java.util.function.Predicate<? super U> c) |
static <T> LazyFutureStream<T> |
of(T... values)
Create a sequential synchronous stream that runs on the current thread
|
static <T> LazyFutureStream<T> |
of(T value)
Create a sequential synchronous stream that runs on the current thread
|
default <U> LazyFutureStream<U> |
ofType(java.lang.Class<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 org.jooq.lambda.tuple.Tuple2<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> |
partitionSequence(java.util.function.Predicate<U> splitter) |
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
|
default LazyFutureStream<U> |
prepend(U... values) |
default LazyFutureStream<U> |
prependStream(java.util.stream.Stream<U> stream) |
default org.jooq.lambda.tuple.Tuple4<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> |
quadruplicate() |
static <T> LazyFutureStream<T> |
react(java.util.function.Supplier<T>... values)
Create a 'free threaded' asynchronous stream that runs on a single thread (not current)
The supplier will be executed asyncrhonously, subsequent tasks will be executed synchronously unless the async() operator is invoked.
|
static <T> LazyFutureStream<T> |
react(java.util.function.Supplier<T> value)
Create a 'free threaded' asynchronous stream that runs on a single thread (not current)
The supplier will be executed asyncrhonously, subsequent tasks will be executed synchronously unless the async() operator
is invoked.
|
default <EX extends java.lang.Throwable> |
recover(java.lang.Class<EX> exceptionClass,
java.util.function.Function<EX,U> fn) |
default LazyFutureStream<U> |
recover(java.util.function.Function<java.lang.Throwable,U> fn) |
default java.util.Optional<U> |
reduce(java.util.function.BinaryOperator<U> accumulator) |
default java.util.List<U> |
reduce(java.lang.Iterable<com.aol.cyclops.sequence.Monoid<U>> reducers) |
default U |
reduce(com.aol.cyclops.sequence.Monoid<U> reducer) |
default java.util.List<U> |
reduce(java.util.stream.Stream<com.aol.cyclops.sequence.Monoid<U>> reducers) |
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 LazyFutureStream<U> |
scanLeft(com.aol.cyclops.sequence.Monoid<U> monoid) |
default <T> LazyFutureStream<T> |
scanLeft(T seed,
java.util.function.BiFunction<T,? super U,T> function)
Scan a stream to the left.
|
default LazyFutureStream<U> |
scanRight(com.aol.cyclops.sequence.Monoid<U> monoid) |
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<LazyFutureStream<U>> consumer)
Give a consumer access to this Stream
|
default LazyFutureStream<U> |
sequential() |
default <K> java.util.Map<K,LazyFutureStream<U>> |
shard(java.util.Map<K,Queue<U>> shards,
java.util.function.Function<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> |
skip(long time,
java.util.concurrent.TimeUnit unit) |
default LazyFutureStream<U> |
skipLast(int num) |
default LazyFutureStream<U> |
skipUntil(java.util.function.Predicate<? super U> predicate)
Returns a stream with all elements skipped for which a predicate
evaluates to false.
|
default LazyFutureStream<U> |
skipWhile(java.util.function.Predicate<? super U> predicate)
Returns a stream with all elements skipped for which a predicate
evaluates to true.
|
default LazyFutureStream<U> |
slice(long from,
long to) |
default LazyFutureStream<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 <R extends java.lang.Comparable<? super R>> |
sorted(java.util.function.Function<? super U,? extends R> function) |
default org.jooq.lambda.tuple.Tuple2<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> |
splitAt(int where) |
default org.jooq.lambda.tuple.Tuple2<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> |
splitBy(java.util.function.Predicate<U> splitter) |
default java.util.Spliterator<U> |
spliterator() |
default org.jooq.lambda.tuple.Tuple2<java.util.Optional<U>,com.aol.cyclops.sequence.SequenceM<U>> |
splitSequenceAtHead() |
default boolean |
startsWith(java.lang.Iterable<U> iterable) |
default boolean |
startsWith(java.util.Iterator<U> iterator) |
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)
React then
Unlike 'with' this method is fluent, and returns another Stage Builder
that can represent the next stage in the dataflow.
|
default <R> LazyFutureStream<R> |
then(java.util.function.Function<U,R> fn,
java.util.concurrent.Executor service) |
default <R> LazyFutureStream<R> |
thenSync(java.util.function.Function<U,R> fn) |
default java.lang.Object[] |
toArray() |
default <A> A[] |
toArray(java.util.function.IntFunction<A[]> generator) |
default <C extends java.util.Collection<U>> |
toCollection(java.util.function.Supplier<C> collectionFactory) |
default java.util.concurrent.CompletableFuture<java.util.List<U>> |
toCompletableFuture() |
default java.util.Collection<U> |
toConcurrentLazyCollection() |
default com.aol.cyclops.sequence.streamable.Streamable<U> |
toConcurrentLazyStreamable() |
default java.util.Collection<U> |
toLazyCollection() |
default java.util.List<U> |
toList() |
default java.util.Optional<java.util.List<U>> |
toOptional() |
default Queue<U> |
toQueue()
Convert the current Stream to a simple-react Queue
|
default java.util.Set<U> |
toSet() |
default <U> java.util.stream.Stream<U> |
toStream() |
default com.aol.cyclops.sequence.streamable.Streamable<U> |
toStreamable() |
default org.jooq.lambda.tuple.Tuple3<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> |
triplicate() |
default LazyFutureStream<U> |
unboundedWaitFree()
This is the default setting, internal queues are backed by a ConcurrentLinkedQueue
This operator will return the next stage to using this Queue type if it has been changed
|
default LazyFutureStream<U> |
unordered() |
default <R> R |
unwrap()
START SEQUENCEM
|
default LazyFutureStream<com.aol.cyclops.sequence.streamable.Streamable<U>> |
windowBySizeAndTime(int maxSize,
long maxTime,
java.util.concurrent.TimeUnit maxTimeUnit) |
default LazyFutureStream<com.aol.cyclops.sequence.streamable.Streamable<U>> |
windowByTime(long time,
java.util.concurrent.TimeUnit t) |
default LazyFutureStream<com.aol.cyclops.sequence.streamable.Streamable<U>> |
windowStatefullyWhile(java.util.function.BiPredicate<com.aol.cyclops.sequence.streamable.Streamable<U>,U> predicate) |
default LazyFutureStream<com.aol.cyclops.sequence.streamable.Streamable<U>> |
windowUntil(java.util.function.Predicate<U> predicate) |
default LazyFutureStream<com.aol.cyclops.sequence.streamable.Streamable<U>> |
windowWhile(java.util.function.Predicate<U> predicate) |
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)
END SEQUENCEM
|
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 boolean |
xMatch(int num,
java.util.function.Predicate<? super U> c) |
default LazyFutureStream<U> |
xPer(int x,
long time,
java.util.concurrent.TimeUnit unit)
Allows x (specified number of) emissions with a time period before
stopping emmissions until specified time has elapsed since last emission
|
default <T> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,T>> |
zip(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. |
default <S,R> LazyFutureStream<org.jooq.lambda.tuple.Tuple3<U,S,R>> |
zip3(java.util.stream.Stream<? extends S> second,
java.util.stream.Stream<? extends R> third) |
default <T2,T3,T4> LazyFutureStream<org.jooq.lambda.tuple.Tuple4<U,T2,T3,T4>> |
zip4(java.util.stream.Stream<T2> second,
java.util.stream.Stream<T3> third,
java.util.stream.Stream<T4> fourth) |
default <S,R> LazyFutureStream<R> |
zipAnyM(com.aol.cyclops.monad.AnyM<? extends S> second,
java.util.function.BiFunction<? super U,? super S,? extends R> zipper) |
default <S,R> LazyFutureStream<R> |
zipSequence(com.aol.cyclops.sequence.SequenceM<? extends S> second,
java.util.function.BiFunction<? super U,? super S,? extends R> zipper) |
default <S,R> LazyFutureStream<R> |
zipStream(java.util.stream.BaseStream<? extends S,? extends java.util.stream.BaseStream<? extends S,?>> second,
java.util.function.BiFunction<? super U,? super S,? extends R> zipper) |
default <R> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,R>> |
zipStream(java.util.stream.Stream<R> other) |
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, flatMapToCompletableFuture, getLastActive, handleExceptions, streamCompletableFutures, withErrorHandler
getErrorHandler, getRetrier, getTaskExecutor, isAsync
getQueueFactory, getTaskExecutor, isAsync, simpleReactStream, simpleReactStream, simpleReactStream, simpleReactStream, simpleReactStreamFrom, simpleReactStreamFromIterable
block, block, blockAndExtract, blockAndExtract, first, getErrorHandler, last
getErrorHandler, getLastActive, getLazyCollector, getMaxActive, getParallelReduction, run, run, runContinuation, runOn, runOnCurrent, runThread
elapsed, elementAt, fromDoubleStream, fromIntStream, fromIterable, fromList, fromLongStream, fromStream, get, onEmptySwitch, range, reversedListOf, reversedOf, single, subscriber, timestamp, unzip, unzip3, unzip4
cast, close, concat, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, cycle, duplicate, foldLeft, foldLeft, foldRight, foldRight, groupBy, groupBy, groupBy, groupBy, groupBy, intersperse, isEmpty, isNotEmpty, join, join, join, join, join, limit, limitUntil, limitWhile, maxBy, minBy, ofType, partition, reverse, scanLeft, scanRight, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, shuffle, shuffle, skip, skipUntil, skipWhile, slice, splitAt, splitAt, splitAtHead, splitAtHead, toCollection, toList, toList, toMap, toMap, toMap, 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
add, addToQueue, getPopulator, returnPopulator, toQueue, toQueue
getQueueFactory
cancel, forwardErrors, getLastActive, getPublisherExecutor, subscribeAsync, subscribeOn, withPublisherExecutor
cancel, forwardErrors, getLastActive, subscribeSync
default OperationsOnFutures<U> actOnFutures()
new LazyReact().react(()->slow(),()->fast())
.zipWithIndex();
//[fast,0l],[slow,1l]
The first result will be fast and will have index 0 (the result index)
Operating on futures
new LazyReact().react(()->slow(),()->fast())
.actOnFutures()
.zipWithIndex();
//[fast,1l],[slow,0l]
The first result will still be fast, but the index will now be the start index 1default CloseableIterator<U> iterator()
Continueable getSubscription()
getSubscription
in interface BaseSimpleReactStream<U>
getSubscription
in interface LazySimpleReactStream<U>
<R> LazyFutureStream<R> withLastActive(LazyStreamWrapper<R> streamWrapper)
withLastActive
in interface LazySimpleReactStream<U>
LazyReact getSimpleReact()
getSimpleReact
in interface BaseSimpleReactStream<U>
getSimpleReact
in interface ConfigurableStream<U,FastFuture<U>>
getSimpleReact
in interface LazySimpleReactStream<U>
default void subscribe(org.reactivestreams.Subscriber<? super U> s)
subscribe
in interface FutureStreamAsyncPublisher<U>
subscribe
in interface FutureStreamSynchronousPublisher<U>
subscribe
in interface org.reactivestreams.Publisher<U>
default java.util.Iterator<java.util.Collection<U>> chunkLastReadIterator()
default LazyFutureStream<java.util.Collection<U>> chunkSinceLastRead()
default long count()
LazyFutureStream<U> withTaskExecutor(java.util.concurrent.Executor e)
withTaskExecutor
in interface ConfigurableStream<U,FastFuture<U>>
withTaskExecutor
in interface LazySimpleReactStream<U>
LazyFutureStream<U> withRetrier(com.nurkiewicz.asyncretry.RetryExecutor retry)
withRetrier
in interface BaseSimpleReactStream<U>
withRetrier
in interface ConfigurableStream<U,FastFuture<U>>
withRetrier
in interface LazySimpleReactStream<U>
LazyFutureStream<U> withLazyCollector(java.util.function.Supplier<LazyResultConsumer<U>> lazy)
LazyFutureStream<U> withQueueFactory(QueueFactory<U> queue)
withQueueFactory
in interface BaseSimpleReactStream<U>
withQueueFactory
in interface ConfigurableStream<U,FastFuture<U>>
withQueueFactory
in interface LazySimpleReactStream<U>
LazyFutureStream<U> withSubscription(Continueable sub)
withSubscription
in interface BaseSimpleReactStream<U>
withSubscription
in interface ConfigurableStream<U,FastFuture<U>>
withSubscription
in interface LazySimpleReactStream<U>
LazyFutureStream<U> withAsync(boolean async)
withAsync
in interface ConfigurableStream<U,FastFuture<U>>
withAsync
in interface LazySimpleReactStream<U>
default void forEach(java.util.function.Consumer<? super U> c)
default Queue<U> toQueue()
LazyToQueue
toQueue
in interface BaseSimpleReactStream<U>
toQueue
in interface FutureStreamAsyncPublisher<U>
toQueue
in interface FutureStreamSynchronousPublisher<U>
toQueue
in interface LazyToQueue<U>
toQueue
in interface ToQueue<U>
default U reduce(U identity, java.util.function.BinaryOperator<U> accumulator)
reduce
in interface LazyStream<U>
reduce
in interface com.aol.cyclops.sequence.SequenceM<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 LazyStream<U>
reduce
in interface com.aol.cyclops.sequence.SequenceM<U>
reduce
in interface java.util.stream.Stream<U>
default java.util.Optional<U> reduce(java.util.function.BinaryOperator<U> accumulator)
reduce
in interface LazyStream<U>
reduce
in interface com.aol.cyclops.sequence.SequenceM<U>
reduce
in interface java.util.stream.Stream<U>
default <R> R collect(java.util.function.Supplier<R> supplier, java.util.function.BiConsumer<R,? super U> accumulator, java.util.function.BiConsumer<R,R> combiner)
collect
in interface LazyStream<U>
collect
in interface java.util.stream.Stream<U>
default LazyFutureStream<U> sync()
sync
in interface BaseSimpleReactStream<U>
default LazyFutureStream<U> async()
async
in interface BaseSimpleReactStream<U>
default LazyFutureStream<U> unboundedWaitFree()
default LazyFutureStream<U> boundedWaitFree(int size)
LazyFutureStream.of(col)
.boundedWaitFree(110)
.flatMap(Collection::stream)
.toList();
size
- Buffer 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 BaseSimpleReactStream<U>
thenSync
in interface LazySimpleReactStream<U>
thenSync
in interface LazyToQueue<U>
default LazyFutureStream<U> peekSync(java.util.function.Consumer<? super U> consumer)
LazySimpleReactStream
peekSync
in interface BaseSimpleReactStream<U>
peekSync
in interface LazySimpleReactStream<U>
peekSync
in interface LazyToQueue<U>
consumer
- Peek consumerdefault void closeAll()
default java.util.Optional<U> findFirst()
default SimpleReactStream<U> convertToSimpleReact()
LazyReact.parallelCommonBuilder()
.react(()->slow(),()->1,()->2)
.peek(System.out::println)
.convertToSimpleReact()
.allOf(list->list)
.block()
default <R> LazyFutureStream<R> map(java.util.function.Function<? super U,? extends R> mapper)
default <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,43shards
- Map of Queue's keyed by shard identifiersharder
- Function to split split incoming elements into shardsdefault LazyFutureStream<U> debounce(long time, java.util.concurrent.TimeUnit unit)
LazyFutureStream.of(1,2,3,4,5,6)
.debounce(1000,TimeUnit.SECONDS).toList();
// [1]
debounce
in interface com.aol.cyclops.sequence.SequenceM<U>
time
- Time from which to accept only one elementunit
- Time unit for specified timedefault LazyFutureStream<U> control(java.util.function.Function<java.util.function.Supplier<U>,java.util.function.Supplier<U>> fn)
fn
- Function takes a supplier, which can be used repeatedly to get
the next value from the Stream. If there are no more values, a
ClosedQueueException will be thrown. This function should
return a Supplier which returns the desired result for the
next element (or just the next element).default <C extends java.util.Collection<U>> LazyFutureStream<C> batch(java.util.function.Function<java.util.function.Supplier<U>,java.util.function.Supplier<C>> fn)
fn
- Function takes a supplier, which can be used repeatedly to get
the next value from the Stream. If there are no more values, a
ClosedQueueException will be thrown. This function should
return a Supplier which creates a collection of the batched
valuesdefault LazyFutureStream<java.util.List<U>> batchBySize(int size)
LazyFutureStream.of(1,2,3,4,5,6)
.batchBySize(3)
.toList();
// [[1,2,3],[4,5,6]]
batchBySize
in interface com.aol.cyclops.sequence.SequenceM<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)
batchBySizeAndTime
in interface com.aol.cyclops.sequence.SequenceM<U>
default <C extends java.util.Collection<U>> LazyFutureStream<C> batchBySize(int size, java.util.function.Supplier<C> supplier)
LazyFutureStream.of(1,1,1,1,1,1)
.batchBySize(3,()->new TreeSet<>())
.toList()
//[[1],[1]]
batchBySize
in interface com.aol.cyclops.sequence.SequenceM<U>
size
- Size of batchsupplier
- Create the batch holding collectiondefault LazyFutureStream<U> jitter(long jitterInNanos)
LazyFutureStream.parallelCommonBuilder()
.of(IntStream.range(0, 100))
.map(it -> it*100)
.jitter(10l)
.peek(System.out::println)
.block();
jitter
in interface com.aol.cyclops.sequence.SequenceM<U>
jitterInNanos
- Max number of nanos for jitter (random number less than this
will be selected)/default LazyFutureStream<U> fixedDelay(long time, java.util.concurrent.TimeUnit unit)
LazyFutureStream.of(1,2,3,4)
.fixedDelay(1,TimeUnit.hours);
Will emit 1 on start, then 2 after an hour, 3 after 2 hours and so on.
However all 4 numbers will be populated in the Stream immediately.
LazyFutureStream.of(1,2,3,4)
.withQueueFactories(QueueFactories.boundedQueue(1))
.fixedDelay(1,TimeUnit.hours);
Will populate each number in the Stream an hour apart.fixedDelay
in interface com.aol.cyclops.sequence.SequenceM<U>
time
- amount of time between emissionsunit
- TimeUnit for emissionsdefault LazyFutureStream<U> onePer(long time, java.util.concurrent.TimeUnit unit)
LazyFutureStream.of(1,2,3,4,5,6)
.onePer(1000,TimeUnit.NANOSECONDS)
.toList();
onePer
in interface com.aol.cyclops.sequence.SequenceM<U>
time
- Frequency period of element emissionunit
- Time unit for frequency perioddefault LazyFutureStream<U> xPer(int x, long time, java.util.concurrent.TimeUnit unit)
LazyFutureStream.of(1,2,3,4,5,6)
.xPer(6,100000000,TimeUnit.NANOSECONDS)
.toList();
xPer
in interface com.aol.cyclops.sequence.SequenceM<U>
x
- Number of allowable emissions per time periodtime
- Frequency time periodunit
- Frequency time unitdefault LazyFutureStream<java.util.List<U>> batchByTime(long time, java.util.concurrent.TimeUnit unit)
LazyFutureStream.react(()->load1(),()->load2(),()->load3(),()->load4(),()->load5(),()->load6())
.batchByTime(15000,TimeUnit.MICROSECONDS);
batchByTime
in interface com.aol.cyclops.sequence.SequenceM<U>
time
- Time period during which all elements should be collectedunit
- Time unit during which all elements should be collecteddefault <C extends java.util.Collection<U>> LazyFutureStream<C> batchByTime(long time, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<C> factory)
List <TreeSet<Integer>> set = LazyFutureStream.ofThread(1,1,1,1,1,1)
.batchByTime(1500,TimeUnit.MICROSECONDS,()-> new TreeSet<>())
.block();
assertThat(set.get(0).size(),is(1));
batchByTime
in interface com.aol.cyclops.sequence.SequenceM<U>
time
- Time period during which all elements should be collectedunit
- Time unit during which all elements should be collectedfactory
- Instantiates the collections used in the batchingdefault <R> LazyFutureStream<R> then(java.util.function.Function<U,R> fn, java.util.concurrent.Executor service)
then
in interface BaseSimpleReactStream<U>
then
in interface LazySimpleReactStream<U>
then
in interface LazyToQueue<U>
default <R> LazyFutureStream<R> then(java.util.function.Function<U,R> fn)
LazySimpleReactStream
new SimpleReact().<Integer, Integer> react(() -> 1, () -> 2, () -> 3)
.then((it) -> it * 100)
.then((it) -> "*" + it)
React then allows event reactors to be chained. Unlike React with, which
returns a collection of Future references, React then is a fluent
interface that returns the React builder - allowing further reactors to
be added to the chain.
React then does not block.
React with can be called after React then which gives access to the full
CompleteableFuture api. CompleteableFutures can be passed back into
SimpleReact via SimpleReact.react(streamOfCompleteableFutures);
See this blog post for examples of what can be achieved via
CompleteableFuture :- http://www.nurkiewicz.com/2013/12/promises-and-completablefuture.htm
l then
in interface BaseSimpleReactStream<U>
then
in interface LazySimpleReactStream<U>
fn
- Function to be applied to the results of the currently active
event tasksdefault java.util.List<LazyFutureStream<U>> copy(int times)
LazyFutureStream.of(1,2,3,4,5,6)
.map(i->i+2)
.copy(5)
.forEach(s -> System.out.println(s.toList()));
times
- to copy this Streamdefault <R> LazyFutureStream<R> switchOnNextValue(java.util.stream.Stream<LazyFutureStream> streams)
LazyFutureStream<Integer> fast = ... // [1,2,3,4,5,6,7..]
LazyFutureStream<Integer> slow = ... // [100,200,300,400,500,600..]
LazyFutureStream<Integer> merged = fast.switchOnNextValue(Stream.of(slow)); //[1,2,3,4,5,6,7,8,100,9,10,11,12,13,14,15,16,200..]
streams
- default <R> LazyFutureStream<R> mergeLatest(LazyFutureStream<?>... streams)
LazyFutureStream<Integer> fast = ... // [1,2,3,4,5,6,7..]
LazyFutureStream<Integer> slow = ... // [100,200,300,400,500,600..]
LazyFutureStream<Integer> merged = fast.mergeLatest(slow); //[1,2,3,4,5,6,7,8,100,9,10,11,12,13,14,15,16,200..]
streams
- default LazyFutureStream<U> onFail(java.util.function.Function<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 BaseSimpleReactStream<U>
onFail
in interface LazySimpleReactStream<U>
fn
- Recovery function, the exception is input, and the recovery
value is outputdefault LazyFutureStream<U> onFail(java.lang.Class<? extends java.lang.Throwable> exceptionClass, java.util.function.Function<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 BaseSimpleReactStream<U>
onFail
in interface LazySimpleReactStream<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 BaseSimpleReactStream<U>
capture
in interface LazySimpleReactStream<U>
errorHandler
- A consumer that recieves and deals with an unrecoverable error
in the dataflowdefault LazyFutureStream<U> peek(java.util.function.Consumer<? super U> consumer)
LazySimpleReactStream
peek
in interface BaseSimpleReactStream<U>
peek
in interface LazySimpleReactStream<U>
peek
in interface org.jooq.lambda.Seq<U>
peek
in interface com.aol.cyclops.sequence.SequenceM<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 BaseSimpleReactStream<U>
filter
in interface LazySimpleReactStream<U>
filter
in interface org.jooq.lambda.Seq<U>
filter
in interface com.aol.cyclops.sequence.SequenceM<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 BaseSimpleReactStream<U>
flatMap
in interface LazySimpleReactStream<U>
flatMap
in interface org.jooq.lambda.Seq<U>
flatMap
in interface com.aol.cyclops.sequence.SequenceM<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<? super U,java.util.concurrent.CompletableFuture<? extends R>> flatFn)
assertThat( new LazyReact()
.of(1,2,3)
.flatMapCompletableFuture(i->CompletableFuture.completedFuture(i))
.block(),equalTo(Arrays.asList(1,2,3)));
In this example the result of the flatMapCompletableFuture is 'flattened' to the raw integer valuesflatMapCompletableFuture
in interface com.aol.cyclops.sequence.SequenceM<U>
flatFn
- flatMap functiondefault <R> LazyFutureStream<R> flatMapToCompletableFutureSync(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 valuesflatMapToCompletableFutureSync
in interface BaseSimpleReactStream<U>
flatMapToCompletableFutureSync
in interface LazySimpleReactStream<U>
flatFn
- flatMap functiondefault <R> LazyFutureStream<R> retry(java.util.function.Function<U,R> fn)
LazySimpleReactStream
retry
in interface BaseSimpleReactStream<U>
retry
in interface LazySimpleReactStream<U>
retry
in interface com.aol.cyclops.sequence.SequenceM<U>
fn
- Function that will be executed and retried on failuredefault <R> LazyFutureStream<R> fromStream(java.util.stream.Stream<R> stream)
fromStream
in interface BaseSimpleReactStream<U>
default <R> LazyFutureStream<R> fromStreamOfFutures(java.util.stream.Stream<FastFuture<R>> stream)
default LazyFutureStream<U> concat(java.util.stream.Stream<U> other)
default LazyFutureStream<U> concat(U other)
// (1, 2, 3, 4)
LazyFutureStream.of(1, 2, 3).concat(4)
default LazyFutureStream<U> concat(U... other)
// (1, 2, 3, 4, 5, 6)
LazyFutureStream.of(1, 2, 3).concat(4, 5, 6)
default <U> LazyFutureStream<U> cast(java.lang.Class<U> type)
cast
in interface BaseSimpleReactStream<U>
cast
in interface org.jooq.lambda.Seq<U>
cast
in interface com.aol.cyclops.sequence.SequenceM<U>
default <U> LazyFutureStream<U> ofType(java.lang.Class<U> type)
ofType
in interface BaseSimpleReactStream<U>
ofType
in interface org.jooq.lambda.Seq<U>
ofType
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> intersperse(U value)
// (1, 0, 2, 0, 3, 0, 4)
LazyFutureStream.of(1, 2, 3, 4).intersperse(0)
intersperse
in interface BaseSimpleReactStream<U>
intersperse
in interface org.jooq.lambda.Seq<U>
intersperse
in interface com.aol.cyclops.sequence.SequenceM<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 com.aol.cyclops.sequence.SequenceM<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 com.aol.cyclops.sequence.SequenceM<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<LazyFutureStream<U>,LazyFutureStream<U>> duplicateFutureStream()
default org.jooq.lambda.tuple.Tuple2<org.jooq.lambda.Seq<U>,org.jooq.lambda.Seq<U>> partition(java.util.function.Predicate<? super U> predicate)
// tuple((1, 3, 5), (2, 4, 6))
LazyFutureStream.of(1, 2, 3, 4, 5,6).partition(i -> i % 2 != 0)
partition
in interface org.jooq.lambda.Seq<U>
partitionFutureStream(Predicate)
,
Seq.partition(Stream, Predicate)
default org.jooq.lambda.tuple.Tuple2<LazyFutureStream<U>,LazyFutureStream<U>> partitionFutureStream(java.util.function.Predicate<? super U> predicate)
LazyFutureStream.of(1, 2, 3, 4, 5, 6).partition(i -> i % 2 != 0)
results in
tuple((1, 3, 5), (2, 4, 6))
predicate
- Predicate to split Streampartition(Predicate)
default LazyFutureStream<U> slice(long from, long to)
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()
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"))
LazyFutureStream.of(1, 2, 3)
.zip(Seq.of("a", "b", "c"))
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
in interface com.aol.cyclops.sequence.SequenceM<U>
zip(Seq, BiFunction)
default <T> LazyFutureStream<T> scanLeft(T seed, java.util.function.BiFunction<T,? super U,T> function)
default <R> LazyFutureStream<R> scanRight(R seed, java.util.function.BiFunction<? super U,R,R> function)
default LazyFutureStream<U> reverse()
default LazyFutureStream<U> shuffle()
default LazyFutureStream<U> shuffle(java.util.Random random)
default LazyFutureStream<U> skipWhile(java.util.function.Predicate<? super U> predicate)
default LazyFutureStream<U> skipUntil(java.util.function.Predicate<? super U> predicate)
default LazyFutureStream<U> limitWhile(java.util.function.Predicate<? super U> predicate)
default LazyFutureStream<U> limitUntil(java.util.function.Predicate<? super U> 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"))
default LazyFutureStream<U> onEmpty(U value)
value
, in case this stream is empty.
LazyFutureStream.of().onEmpty(1)
//1
default LazyFutureStream<U> onEmptyGet(java.util.function.Supplier<U> supplier)
supplier
, in case this stream is empty.
LazyFutureStream.of().onEmptyGet(() -> 1)
//1
default <X extends java.lang.Throwable> LazyFutureStream<U> onEmptyThrow(java.util.function.Supplier<X> supplier)
supplier
, in case this stream is empty.
LazyFutureStream.of().capture(e -> ex = e).onEmptyThrow(() -> new RuntimeException()).toList();
//throws RuntimeException
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))
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))
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))
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));
default LazyFutureStream<U> cycle(int times)
assertThat(LazyFutureStream.of(1,2,2).cycle(3)
.collect(Collectors.toList()),
equalTo(Arrays.asList(1,2,2,1,2,2,1,2,2)));
cycle
in interface com.aol.cyclops.sequence.SequenceM<U>
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)));
cycleWhile
in interface com.aol.cyclops.sequence.SequenceM<U>
predicate
- repeat while truedefault LazyFutureStream<U> cycleUntil(java.util.function.Predicate<? super U> predicate)
count =0;
assertThat(LazyFutureStream.of(1,2,2,3).cycleUntil(next -> count++>10 )
.collect(Collectors.toList()),equalTo(Arrays.asList(1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2)));
cycleUntil
in interface com.aol.cyclops.sequence.SequenceM<U>
predicate
- repeat while truedefault java.util.stream.Stream<U> stream()
default LazyFutureStream<U> parallel()
default LazyFutureStream<U> sequential()
default LazyFutureStream<U> unordered()
default LazyFutureStream<U> onClose(java.lang.Runnable closeHandler)
default LazyFutureStream<U> sorted()
default LazyFutureStream<U> sorted(java.util.Comparator<? super U> comparator)
default LazyFutureStream<U> self(java.util.function.Consumer<LazyFutureStream<U>> consumer)
consumer
- Consumer that will recieve current stagedefault <R> R unwrap()
unwrap
in interface com.aol.cyclops.sequence.SequenceM<U>
unwrap
in interface com.aol.cyclops.sequence.Unwrapable
default <T1> LazyFutureStream<T1> flatten()
flatten
in interface com.aol.cyclops.sequence.SequenceM<U>
default java.util.Optional<java.util.List<U>> toOptional()
toOptional
in interface com.aol.cyclops.sequence.SequenceM<U>
default java.util.concurrent.CompletableFuture<java.util.List<U>> toCompletableFuture()
toCompletableFuture
in interface com.aol.cyclops.sequence.SequenceM<U>
default java.util.Spliterator<U> spliterator()
default boolean isParallel()
default java.util.stream.IntStream mapToInt(java.util.function.ToIntFunction<? super U> mapper)
default java.util.stream.LongStream mapToLong(java.util.function.ToLongFunction<? super U> mapper)
default java.util.stream.DoubleStream mapToDouble(java.util.function.ToDoubleFunction<? super U> mapper)
default java.util.stream.IntStream flatMapToInt(java.util.function.Function<? super U,? extends java.util.stream.IntStream> mapper)
default java.util.stream.LongStream flatMapToLong(java.util.function.Function<? super U,? extends java.util.stream.LongStream> mapper)
default java.util.stream.DoubleStream flatMapToDouble(java.util.function.Function<? super U,? extends java.util.stream.DoubleStream> mapper)
default void forEachOrdered(java.util.function.Consumer<? super U> action)
forEachOrdered
in interface java.util.stream.Stream<U>
default java.lang.Object[] toArray()
toArray
in interface java.util.stream.Stream<U>
default <A> A[] toArray(java.util.function.IntFunction<A[]> generator)
toArray
in interface java.util.stream.Stream<U>
default <K> java.util.Map<K,java.util.List<U>> groupBy(java.util.function.Function<? super U,? extends K> classifier)
default boolean allMatch(java.util.function.Predicate<? super U> c)
default boolean anyMatch(java.util.function.Predicate<? super U> c)
default boolean noneMatch(java.util.function.Predicate<? super U> c)
default java.lang.String join()
default java.lang.String join(java.lang.String sep)
join
in interface com.aol.cyclops.sequence.SequenceM<U>
default java.lang.String join(java.lang.String sep, java.lang.String start, java.lang.String end)
join
in interface com.aol.cyclops.sequence.SequenceM<U>
default <C extends java.lang.Comparable<C>> java.util.Optional<U> minBy(java.util.function.Function<U,C> f)
default <C extends java.lang.Comparable<C>> java.util.Optional<U> maxBy(java.util.function.Function<U,C> f)
default java.util.Optional<U> findAny()
default U foldLeft(U identity, java.util.function.BinaryOperator<U> accumulator)
foldLeft
in interface com.aol.cyclops.sequence.SequenceM<U>
default U foldRight(U identity, java.util.function.BinaryOperator<U> accumulator)
foldRight
in interface com.aol.cyclops.sequence.SequenceM<U>
default java.util.Set<U> toSet()
default java.util.List<U> toList()
default <C extends java.util.Collection<U>> C toCollection(java.util.function.Supplier<C> collectionFactory)
default <R> com.aol.cyclops.sequence.SequenceM<U> distinct(java.util.function.Function<? super U,? extends R> keyExtractor)
default org.jooq.lambda.tuple.Tuple2<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> duplicateSequence()
duplicateSequence
in interface com.aol.cyclops.sequence.SequenceM<U>
default org.jooq.lambda.tuple.Tuple3<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> triplicate()
triplicate
in interface com.aol.cyclops.sequence.SequenceM<U>
default org.jooq.lambda.tuple.Tuple4<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> quadruplicate()
quadruplicate
in interface com.aol.cyclops.sequence.SequenceM<U>
default org.jooq.lambda.tuple.Tuple2<java.util.Optional<U>,com.aol.cyclops.sequence.SequenceM<U>> splitSequenceAtHead()
splitSequenceAtHead
in interface com.aol.cyclops.sequence.SequenceM<U>
default org.jooq.lambda.tuple.Tuple2<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> splitAt(int where)
splitAt
in interface com.aol.cyclops.sequence.SequenceM<U>
default org.jooq.lambda.tuple.Tuple2<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> splitBy(java.util.function.Predicate<U> splitter)
splitBy
in interface com.aol.cyclops.sequence.SequenceM<U>
default org.jooq.lambda.tuple.Tuple2<com.aol.cyclops.sequence.SequenceM<U>,com.aol.cyclops.sequence.SequenceM<U>> partitionSequence(java.util.function.Predicate<U> splitter)
partitionSequence
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> cycle(com.aol.cyclops.sequence.Monoid<U> m, int times)
cycle
in interface com.aol.cyclops.sequence.SequenceM<U>
default <R> LazyFutureStream<R> cycle(java.lang.Class<R> monadC, int times)
cycle
in interface com.aol.cyclops.sequence.SequenceM<U>
default <R> LazyFutureStream<org.jooq.lambda.tuple.Tuple2<U,R>> zipStream(java.util.stream.Stream<R> other)
zipStream
in interface com.aol.cyclops.sequence.SequenceM<U>
default <S,R> LazyFutureStream<org.jooq.lambda.tuple.Tuple3<U,S,R>> zip3(java.util.stream.Stream<? extends S> second, java.util.stream.Stream<? extends R> third)
zip3
in interface com.aol.cyclops.sequence.SequenceM<U>
default <T2,T3,T4> LazyFutureStream<org.jooq.lambda.tuple.Tuple4<U,T2,T3,T4>> zip4(java.util.stream.Stream<T2> second, java.util.stream.Stream<T3> third, java.util.stream.Stream<T4> fourth)
zip4
in interface com.aol.cyclops.sequence.SequenceM<U>
default <S,R> LazyFutureStream<R> zipSequence(com.aol.cyclops.sequence.SequenceM<? extends S> second, java.util.function.BiFunction<? super U,? super S,? extends R> zipper)
zipSequence
in interface com.aol.cyclops.sequence.SequenceM<U>
default <S,R> LazyFutureStream<R> zipAnyM(com.aol.cyclops.monad.AnyM<? extends S> second, java.util.function.BiFunction<? super U,? super S,? extends R> zipper)
zipAnyM
in interface com.aol.cyclops.sequence.SequenceM<U>
default <S,R> LazyFutureStream<R> zipStream(java.util.stream.BaseStream<? extends S,? extends java.util.stream.BaseStream<? extends S,?>> second, java.util.function.BiFunction<? super U,? super S,? extends R> zipper)
zipStream
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<java.util.List<U>> grouped(int groupSize)
grouped
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> scanLeft(com.aol.cyclops.sequence.Monoid<U> monoid)
scanLeft
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> scanRight(com.aol.cyclops.sequence.Monoid<U> monoid)
scanRight
in interface com.aol.cyclops.sequence.SequenceM<U>
default boolean xMatch(int num, java.util.function.Predicate<? super U> c)
xMatch
in interface com.aol.cyclops.sequence.SequenceM<U>
default com.aol.cyclops.sequence.HeadAndTail<U> headAndTail()
headAndTail
in interface com.aol.cyclops.sequence.SequenceM<U>
default java.util.Optional<com.aol.cyclops.sequence.HeadAndTail<U>> headAndTailOptional()
headAndTailOptional
in interface com.aol.cyclops.sequence.SequenceM<U>
default <R> R mapReduce(com.aol.cyclops.sequence.Monoid<R> reducer)
mapReduce
in interface com.aol.cyclops.sequence.SequenceM<U>
default <R> R mapReduce(java.util.function.Function<? super U,? extends R> mapper, com.aol.cyclops.sequence.Monoid<R> reducer)
mapReduce
in interface com.aol.cyclops.sequence.SequenceM<U>
default java.util.List collectStream(java.util.stream.Stream<java.util.stream.Collector> collectors)
collectStream
in interface com.aol.cyclops.sequence.SequenceM<U>
default <R> java.util.List<R> collectIterable(java.lang.Iterable<java.util.stream.Collector> collectors)
collectIterable
in interface com.aol.cyclops.sequence.SequenceM<U>
default U reduce(com.aol.cyclops.sequence.Monoid<U> reducer)
reduce
in interface com.aol.cyclops.sequence.SequenceM<U>
default java.util.List<U> reduce(java.util.stream.Stream<com.aol.cyclops.sequence.Monoid<U>> reducers)
reduce
in interface com.aol.cyclops.sequence.SequenceM<U>
default java.util.List<U> reduce(java.lang.Iterable<com.aol.cyclops.sequence.Monoid<U>> reducers)
reduce
in interface com.aol.cyclops.sequence.SequenceM<U>
default U foldLeft(com.aol.cyclops.sequence.Monoid<U> reducer)
foldLeft
in interface com.aol.cyclops.sequence.SequenceM<U>
default <T> T foldLeftMapToType(com.aol.cyclops.sequence.Monoid<T> reducer)
foldLeftMapToType
in interface com.aol.cyclops.sequence.SequenceM<U>
default U foldRight(com.aol.cyclops.sequence.Monoid<U> reducer)
foldRight
in interface com.aol.cyclops.sequence.SequenceM<U>
default <T> T foldRightMapToType(com.aol.cyclops.sequence.Monoid<T> reducer)
foldRightMapToType
in interface com.aol.cyclops.sequence.SequenceM<U>
default com.aol.cyclops.sequence.streamable.Streamable<U> toStreamable()
toStreamable
in interface com.aol.cyclops.sequence.SequenceM<U>
default <U> java.util.stream.Stream<U> toStream()
toStream
in interface com.aol.cyclops.sequence.SequenceM<U>
default boolean startsWith(java.lang.Iterable<U> iterable)
startsWith
in interface com.aol.cyclops.sequence.SequenceM<U>
default boolean startsWith(java.util.Iterator<U> iterator)
startsWith
in interface com.aol.cyclops.sequence.SequenceM<U>
default com.aol.cyclops.monad.AnyM<U> anyM()
anyM
in interface com.aol.cyclops.sequence.SequenceM<U>
default <R> LazyFutureStream<R> flatMapAnyM(java.util.function.Function<? super U,com.aol.cyclops.monad.AnyM<? extends R>> fn)
flatMapAnyM
in interface com.aol.cyclops.sequence.SequenceM<U>
default <R> LazyFutureStream<R> flatMapCollection(java.util.function.Function<? super U,java.util.Collection<? extends R>> fn)
flatMapCollection
in interface com.aol.cyclops.sequence.SequenceM<U>
default <R> LazyFutureStream<R> flatMapStream(java.util.function.Function<? super U,java.util.stream.BaseStream<? extends R,?>> fn)
flatMapStream
in interface com.aol.cyclops.sequence.SequenceM<U>
default <R> LazyFutureStream<R> flatMapOptional(java.util.function.Function<? super U,java.util.Optional<? extends R>> fn)
flatMapOptional
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<java.lang.Character> flatMapCharSequence(java.util.function.Function<? super U,java.lang.CharSequence> fn)
flatMapCharSequence
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<java.lang.String> flatMapFile(java.util.function.Function<? super U,java.io.File> fn)
flatMapFile
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<java.lang.String> flatMapURL(java.util.function.Function<? super U,java.net.URL> fn)
flatMapURL
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<java.lang.String> flatMapBufferedReader(java.util.function.Function<? super U,java.io.BufferedReader> fn)
flatMapBufferedReader
in interface com.aol.cyclops.sequence.SequenceM<U>
default java.util.Collection<U> toLazyCollection()
toLazyCollection
in interface com.aol.cyclops.sequence.SequenceM<U>
default java.util.Collection<U> toConcurrentLazyCollection()
toConcurrentLazyCollection
in interface com.aol.cyclops.sequence.SequenceM<U>
default com.aol.cyclops.sequence.streamable.Streamable<U> toConcurrentLazyStreamable()
toConcurrentLazyStreamable
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> appendStream(java.util.stream.Stream<U> stream)
appendStream
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> prependStream(java.util.stream.Stream<U> stream)
prependStream
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> append(U... values)
append
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> prepend(U... values)
prepend
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> insertAt(int pos, U... values)
insertAt
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> deleteBetween(int start, int end)
deleteBetween
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> insertStreamAt(int pos, java.util.stream.Stream<U> stream)
insertStreamAt
in interface com.aol.cyclops.sequence.SequenceM<U>
default com.aol.cyclops.sequence.future.FutureOperations<U> futureOperations()
default com.aol.cyclops.sequence.future.FutureOperations<U> futureOperations(java.util.concurrent.Executor exec)
futureOperations
in interface com.aol.cyclops.sequence.SequenceM<U>
default boolean endsWith(java.lang.Iterable<U> iterable)
endsWith
in interface com.aol.cyclops.sequence.SequenceM<U>
default boolean endsWith(java.util.stream.Stream<U> stream)
endsWith
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> skip(long time, java.util.concurrent.TimeUnit unit)
skip
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> limit(long time, java.util.concurrent.TimeUnit unit)
limit
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> skipLast(int num)
skipLast
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> limitLast(int num)
limitLast
in interface com.aol.cyclops.sequence.SequenceM<U>
default com.aol.cyclops.sequence.HotStream<U> hotStream(java.util.concurrent.Executor e)
hotStream
in interface com.aol.cyclops.sequence.SequenceM<U>
default com.aol.cyclops.sequence.HotStream<U> hotStream()
HotStream<Integer> ints = new LazyReact().range(0,Integer.MAX_VALUE)
.hotStream()
ints.connect().forEach(System.out::println);
//print out all the ints
//multiple consumers are possible, so other Streams can connect on different Threads
default U firstValue()
firstValue
in interface com.aol.cyclops.sequence.SequenceM<U>
default <C extends java.util.Collection<U>> LazyFutureStream<C> batchBySizeAndTime(int size, long time, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<C> factory)
batchBySizeAndTime
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<com.aol.cyclops.sequence.streamable.Streamable<U>> windowBySizeAndTime(int maxSize, long maxTime, java.util.concurrent.TimeUnit maxTimeUnit)
windowBySizeAndTime
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<com.aol.cyclops.sequence.streamable.Streamable<U>> windowWhile(java.util.function.Predicate<U> predicate)
windowWhile
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<com.aol.cyclops.sequence.streamable.Streamable<U>> windowUntil(java.util.function.Predicate<U> predicate)
windowUntil
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<com.aol.cyclops.sequence.streamable.Streamable<U>> windowStatefullyWhile(java.util.function.BiPredicate<com.aol.cyclops.sequence.streamable.Streamable<U>,U> predicate)
windowStatefullyWhile
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<com.aol.cyclops.sequence.streamable.Streamable<U>> windowByTime(long time, java.util.concurrent.TimeUnit t)
windowByTime
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<java.util.List<U>> batchUntil(java.util.function.Predicate<U> predicate)
batchUntil
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<java.util.List<U>> batchWhile(java.util.function.Predicate<U> predicate)
batchWhile
in interface com.aol.cyclops.sequence.SequenceM<U>
default <C extends java.util.Collection<U>> LazyFutureStream<C> batchWhile(java.util.function.Predicate<U> predicate, java.util.function.Supplier<C> factory)
batchWhile
in interface com.aol.cyclops.sequence.SequenceM<U>
default <R extends java.lang.Comparable<? super R>> LazyFutureStream<U> sorted(java.util.function.Function<? super U,? extends R> function)
default <C extends java.util.Collection<U>> LazyFutureStream<C> batchUntil(java.util.function.Predicate<U> predicate, java.util.function.Supplier<C> factory)
batchUntil
in interface com.aol.cyclops.sequence.SequenceM<U>
default LazyFutureStream<U> recover(java.util.function.Function<java.lang.Throwable,U> fn)
recover
in interface com.aol.cyclops.sequence.SequenceM<U>
default <EX extends java.lang.Throwable> LazyFutureStream<U> recover(java.lang.Class<EX> exceptionClass, java.util.function.Function<EX,U> fn)
recover
in interface com.aol.cyclops.sequence.SequenceM<U>
LazyFutureStream<U> withParallelReduction(ParallelReductionConfig parallelReductionConfig)
static <U> LazyFutureStream<U> parallel(U... array)
parallel
in interface BaseSimpleReactStream<U>
array
- Values to react toThreadPools.getStandard()
,
ThreadPools.setUseCommon(boolean)
static <T> LazyFutureStream<T> lazyFutureStreamFrom(java.util.stream.Stream<java.util.concurrent.CompletableFuture<T>> stream)
static <T> LazyFutureStream<T> lazyFutureStream(java.util.concurrent.CompletableFuture<T> value)
static <T> LazyFutureStream<T> lazyFutureStream(java.util.concurrent.CompletableFuture<T>... values)
static <T> LazyFutureStream<T> react(java.util.function.Supplier<T> value)
react
in interface BaseSimpleReactStream<U>
Stream.of(Object)
@SafeVarargs static <T> LazyFutureStream<T> react(java.util.function.Supplier<T>... values)
react
in interface BaseSimpleReactStream<U>
static <T> LazyFutureStream<T> of(T value)
@SafeVarargs static <T> LazyFutureStream<T> of(T... values)
static <T> LazyFutureStream<T> freeThread(T value)
freeThread
in interface BaseSimpleReactStream<U>
ThreadPools.setUseCommon(boolean)
@SafeVarargs static <T> LazyFutureStream<T> freeThread(T... values)
freeThread
in interface BaseSimpleReactStream<U>
ThreadPools.setUseCommon(boolean)
static <T> LazyFutureStream<T> empty()
empty
in interface BaseSimpleReactStream<U>
empty
in interface org.jooq.lambda.Seq<U>
empty
in interface java.util.stream.Stream<U>
static <T> LazyFutureStream<T> iterate(T seed, java.util.function.UnaryOperator<T> f)
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)