public class LazyFutureStreamImpl<U> extends java.lang.Object implements LazyFutureStream<U>
| Constructor and Description |
|---|
LazyFutureStreamImpl(LazyReact lazyReact,
java.util.stream.Stream<U> stream) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allMatch(java.util.function.Predicate<? super U> c)
True if predicate matches all elements when Monad converted to a Stream
|
boolean |
anyMatch(java.util.function.Predicate<? super U> c)
True if a single element matches when Monad converted to a Stream
|
LazyFutureStream<U> |
append(U value) |
void |
cancel()
Cancel the CompletableFutures in this stage of the stream
|
void |
close() |
<R,A> R |
collect(java.util.stream.Collector<? super U,A,R> collector) |
org.jooq.lambda.Collectable<U> |
collectable()
Narrow this class to a Collectable
|
long |
count() |
U |
foldRight(Monoid<U> reducer)
ReactiveSeq.of("a","b","c").foldRight(Reducers.toString(""));
// "cab"
|
U |
foldRight(U identity,
java.util.function.BinaryOperator<U> accumulator)
Immutable reduction from right to left
|
<T> T |
foldRightMapToType(Reducer<T> reducer)
Attempt to map this Monad to the same type as the supplied Monoid (using
mapToType on the monoid interface) Then use Monoid to reduce values
|
java.lang.String |
format() |
void |
forwardErrors(java.util.function.Consumer<java.lang.Throwable> c) |
LazyReact |
getPopulator() |
com.nurkiewicz.asyncretry.RetryExecutor |
getRetrier() |
java.util.concurrent.Executor |
getTaskExecutor() |
HeadAndTail<U> |
headAndTail()
extract head and tail together, where head is expected to be present
|
HotStream<U> |
hotStream(java.util.concurrent.Executor e)
Turns this ReactiveSeq into a HotStream, a connectable Stream, being executed on a thread on the
supplied executor, that is producing data.
|
boolean |
isAsync() |
java.lang.String |
join()
assertEquals("123".length(),ReactiveSeq.of(1, 2, 3).join().length());
|
java.lang.String |
join(java.lang.String sep)
assertEquals("1, 2, 3".length(), ReactiveSeq.of(1, 2, 3).join(", ").length());
|
java.lang.String |
join(java.lang.String sep,
java.lang.String start,
java.lang.String end)
assertEquals("^1|2|3$".length(), of(1, 2, 3).join("|", "^", "$").length());
|
<R> R |
mapReduce(java.util.function.Function<? super U,? extends R> mapper,
Monoid<R> reducer)
Attempt to map this Monad to the same type as the supplied Monoid, using
supplied function Then use Monoid to reduce values
|
<R> R |
mapReduce(Reducer<R> reducer)
Attempt to map this Sequence to the same type as the supplied Monoid
(Reducer) Then use Monoid to reduce values
|
java.util.Optional<U> |
max(java.util.Comparator<? super U> comparator) |
LazyFutureStream<U> |
maxActive(int max)
Configure the max active concurrent tasks.
|
java.util.Optional<U> |
min(java.util.Comparator<? super U> comparator) |
boolean |
noneMatch(java.util.function.Predicate<? super U> c) |
PausableHotStream<U> |
pausableHotStream(java.util.concurrent.Executor e)
Turns this ReactiveSeq into a HotStream, a connectable & pausable Stream, being executed on a thread on the
supplied executor, that is producing data.
|
LazyFutureStream<U> |
prepend(U value) |
HotStream<U> |
primedHotStream(java.util.concurrent.Executor e)
Return a HotStream that will start emitting data when the first connecting Stream connects.
|
PausableHotStream<U> |
primedPausableHotStream(java.util.concurrent.Executor e)
Return a pausable HotStream that will start emitting data when the first connecting Stream connects.
|
ListX<U> |
reduce(java.lang.Iterable<? extends Monoid<U>> reducers)
Reduce with multiple reducers in parallel NB if this Monad is an Optional
[Arrays.asList(1,2,3)] reduce will operate on the Optional as if the list
was one value To reduce over the values on the list, called
streamedMonad() first.
|
U |
reduce(Monoid<U> reducer)
ReactiveSeq.of("hello","2","world","4").reduce(Reducers.toString(","));
//hello,2,world,4
|
ListX<U> |
reduce(java.util.stream.Stream<? extends Monoid<U>> reducers)
Reduce with multiple reducers in parallel NB if this Monad is an Optional
[Arrays.asList(1,2,3)] reduce will operate on the Optional as if the list
was one value To reduce over the values on the list, called
streamedMonad() first.
|
void |
returnPopulator(LazyReact service) |
HotStream<U> |
schedule(java.lang.String cron,
java.util.concurrent.ScheduledExecutorService ex)
Execute this Stream on a schedule
|
HotStream<U> |
scheduleFixedDelay(long delay,
java.util.concurrent.ScheduledExecutorService ex)
Execute this Stream on a schedule
|
HotStream<U> |
scheduleFixedRate(long rate,
java.util.concurrent.ScheduledExecutorService ex)
Execute this Stream on a schedule
|
<T> LazyFutureStream<T> |
unit(T unit) |
<T> LazyFutureStream<T> |
unitIterator(java.util.Iterator<T> it) |
LazyFutureStream<U> |
withAsync(boolean b) |
LazyFutureStream<U> |
withLastActive(LazyStreamWrapper w) |
LazyFutureStream<U> |
withRetrier(com.nurkiewicz.asyncretry.RetryExecutor retry) |
LazyFutureStream<U> |
withTaskExecutor(java.util.concurrent.Executor e) |
boolean |
xMatch(int num,
java.util.function.Predicate<? super U> c)
Check that there are specified number of matches of predicate in the
Stream
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitactOnFutures, anyM, ap1, append, appendStream, applicatives, async, boundedWaitFree, capture, cast, chunkLastReadIterator, chunkSinceLastRead, closeAll, collect, combinations, combine, concat, concat, concat, control, convertToSimpleReact, copy, crossJoin, cycle, cycle, cycle, cycleUntil, cycleWhile, debounce, deleteBetween, distinct, distinct, dropRight, dropUntil, dropWhile, duplicate, duplicateFutureStream, duplicateSequence, elapsed, empty, endsWith, endsWithIterable, filter, filterNot, findAny, findFirst, firstValue, fixedDelay, flatMap, flatMapAnyM, flatMapCompletableFuture, flatMapIterable, flatMapStream, flatMapToDouble, flatMapToInt, flatMapToLong, flatten, foldable, foldRight, forEach, forEach2, forEach2, forEach3, forEach3, forEachEvent, forEachOrdered, forEachWithError, forEachX, forEachXEvents, forEachXWithError, freeThread, freeThread, fromStream, fromStreamOfFutures, futureOperations, futureOperations, generate, generate, generate, getSimpleReact, getSubscription, group, grouped, grouped, groupedBySizeAndTime, groupedBySizeAndTime, groupedByTime, groupedByTime, groupedStatefullyWhile, groupedUntil, groupedUntil, groupedWhile, groupedWhile, hotStream, innerJoin, insertAt, insertStreamAt, intersperse, isParallel, iterate, iterator, jitter, lazyFutureStream, lazyFutureStream, lazyFutureStream, lazyFutureStream, lazyFutureStreamFrom, lazyFutureStreamFromIterable, leftOuterJoin, limit, limit, limitLast, limitUntil, limitWhile, map, mapToDouble, mapToInt, mapToLong, mergeLatest, notNull, of, of, ofType, onClose, onEmpty, onEmptyGet, onEmptySwitch, onEmptyThrow, onePer, onFail, onFail, parallel, parallel, partition, partitionFutureStream, partitionSequence, patternMatch, peek, peekSync, permutations, prepend, prependStream, quadruplicate, react, react, recover, recover, reduce, reduce, reduce, reduce, remove, retry, reverse, rightOuterJoin, scanLeft, scanLeft, scanRight, scanRight, self, sequential, shard, shuffle, shuffle, skip, skip, skipLast, skipUntil, skipWhile, slice, sliding, sliding, sorted, sorted, sorted, splitAt, splitBy, spliterator, splitSequenceAtHead, startsWith, startsWithIterable, stream, subscribe, subStream, switchOnNextValue, sync, takeRight, takeUntil, takeWhile, then, then, thenSync, toArray, toArray, toCollection, toCompletableFuture, toConcurrentLazyCollection, toConcurrentLazyStreamable, toLazyCollection, toList, toOptional, toQueue, toSet, toStream, toStreamable, trampoline, triplicate, unboundedWaitFree, unordered, unwrap, withLazyCollector, withQueueFactory, withSubscription, xPer, zip, zip, zip3, zip4, zipAnyM, zipSequence, zipStream, zipStream, zipWithIndexassureSimpleReactException, copySimpleReactStream, filterSync, flatMapToCompletableFuture, flatMapToCompletableFutureSync, getLastActive, handleExceptions, streamCompletableFutures, withErrorHandlergetErrorHandlergetQueueFactory, simpleReactStream, simpleReactStream, simpleReactStream, simpleReactStream, simpleReactStreamFrom, simpleReactStreamFromIterableblock, block, getErrorHandlergetErrorHandler, getLastActive, getLazyCollector, getMaxActive, run, run, runContinuation, runOnCurrent, runThreadavg, avg, avgDouble, avgInt, avgLong, combinations, count, countDistinct, countDistinct, countDistinctBy, countDistinctBy, crossJoin, crossJoin, elementAt, fromDoubleStream, fromIntStream, fromIterable, fromIterator, fromList, fromLongStream, fromPublisher, fromStream, get, groupBy, grouped, grouped, innerJoin, innerJoin, innerJoin, leftOuterJoin, leftOuterJoin, leftOuterJoin, limitUntilClosed, max, max, max, maxBy, maxBy, median, median, medianBy, medianBy, min, min, min, minBy, minBy, mode, percentile, percentile, percentileBy, percentileBy, print, print, printErr, printOut, range, rangeLong, retry, reversedListOf, reversedOf, rightOuterJoin, rightOuterJoin, single, single, singleOptional, size, skipUntilClosed, subscriber, sum, sum, sumDouble, sumInt, sumLong, timestamp, toList, toMap, toSet, toString, toString, unzip, unzip3, unzip4, zipremoveAll, removeAll, removeAll, removeAll, retainAll, retainAll, retainAll, retainAllgroupedStatefullyWhileT, groupedT, groupedUntilT, groupedWhileT, slidingT, slidingTbitAnd, bitAnd, bitAndInt, bitAndLong, bitOr, bitOr, bitOrInt, bitOrLong, commonPrefix, commonSuffix, maxAll, maxAll, maxAll, maxAll, maxAllBy, maxAllBy, minAll, minAll, minAll, minAll, minAllBy, minAllBy, modeAll, modeAllBy, modeBy, toMapwindow, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, windowappend, append, append, append, cast, concat, concat, concat, concat, concat, concat, concat, contains, containsAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, containsAny, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, crossJoin, cycle, cycle, cycle, cycle, cycle, cycle, cycle, drop, duplicate, findFirst, findSingle, foldLeft, foldLeft, foldLeft, foldLeft, foldRight, foldRight, foldRight, groupBy, groupBy, groupBy, groupBy, groupBy, grouped, grouped, grouped, grouped, grouped, grouped, intersperse, isEmpty, isNotEmpty, join, join, join, join, join, limit, limitUntil, limitUntilClosed, limitWhile, limitWhileClosed, limitWhileClosed, ofType, partition, prepend, prepend, prepend, prepend, range, range, range, range, range, range, range, range, range, range, range, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, rangeClosed, reverse, reverse, reverse, scanLeft, scanLeft, scanLeft, scanRight, scanRight, scanRight, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, seq, shuffle, shuffle, shuffle, shuffle, shuffle, shuffle, skip, skipUntil, skipUntilClosed, skipWhile, skipWhileClosed, skipWhileClosed, slice, sliding, sorted, splitAt, splitAt, splitAtHead, splitAtHead, take, toCollection, toList, toMap, toMap, toSet, toString, toString, transform, unfold, unzip, unzip, unzip, unzip, unzip, unzip, unzip, unzip, unzip, unzip, unzip, unzip, window, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipAll, zipWithIndex, zipWithIndex, zipWithIndexap2, ap3, ap4, ap5flatMapPublisher, flatMapPublisher, flatMapPublisher, mergePublisher, mergePublisherlazyOperations, traversableseq, toDequeX, toEvalAlways, toEvalLater, toEvalNow, toFutureStream, toFutureStream, toFutureW, toIor, toIorSecondary, toListX, toMapX, toMaybe, toPBagX, toPMapX, toPOrderedSetX, toPQueueX, toPSetX, toPStackX, toPVectorX, toQueueX, toSetX, toSimpleReact, toSimpleReact, toSortedSetX, toTry, toValue, toValueMap, toValueSet, toXor, toXorSecondaryadd, addToQueue, toQueue, toQueuegetQueueFactorygetLastActive, subscribeSyncpublic void forwardErrors(java.util.function.Consumer<java.lang.Throwable> c)
forwardErrors in interface FutureStreamSynchronousPublisher<U>public LazyReact getPopulator()
getPopulator in interface LazyToQueue<U>public void returnPopulator(LazyReact service)
returnPopulator in interface LazyToQueue<U>public <R,A> R collect(java.util.stream.Collector<? super U,A,R> collector)
collect in interface ReactiveSeq<U>collect in interface CyclopsCollectable<U>collect in interface java.util.stream.Stream<U>collect in interface org.jooq.lambda.Collectable<U>public void close()
public LazyFutureStream<U> withAsync(boolean b)
withAsync in interface ConfigurableStream<U,FastFuture<U>>withAsync in interface LazyFutureStream<U>withAsync in interface LazySimpleReactStream<U>public java.util.concurrent.Executor getTaskExecutor()
getTaskExecutor in interface BaseSimpleReactStream<U>getTaskExecutor in interface ConfigurableStream<U,FastFuture<U>>public com.nurkiewicz.asyncretry.RetryExecutor getRetrier()
getRetrier in interface ConfigurableStream<U,FastFuture<U>>public boolean isAsync()
isAsync in interface BaseSimpleReactStream<U>isAsync in interface ConfigurableStream<U,FastFuture<U>>public LazyFutureStream<U> withTaskExecutor(java.util.concurrent.Executor e)
withTaskExecutor in interface ConfigurableStream<U,FastFuture<U>>withTaskExecutor in interface LazyFutureStream<U>withTaskExecutor in interface LazySimpleReactStream<U>public LazyFutureStream<U> withRetrier(com.nurkiewicz.asyncretry.RetryExecutor retry)
withRetrier in interface BaseSimpleReactStream<U>withRetrier in interface ConfigurableStream<U,FastFuture<U>>withRetrier in interface LazyFutureStream<U>withRetrier in interface LazySimpleReactStream<U>public LazyFutureStream<U> withLastActive(LazyStreamWrapper w)
withLastActive in interface LazyFutureStream<U>withLastActive in interface LazySimpleReactStream<U>public LazyFutureStream<U> maxActive(int max)
LazyFutureStream
List<String> data = new LazyReact().react(urlFile)
.maxActive(100)
.flatMap(this::loadUrls)
.map(this::callUrls)
.block();
maxActive in interface LazyFutureStream<U>max - Maximum number of active task chainspublic void cancel()
cancel in interface FutureStreamSynchronousPublisher<U>public HotStream<U> schedule(java.lang.String cron, java.util.concurrent.ScheduledExecutorService ex)
ReactiveSeq
//run at 8PM every night
ReactiveSeq.generate(()->"next job:"+formatDate(new Date()))
.map(this::processJob)
.schedule("0 20 * * *",Executors.newScheduledThreadPool(1));
Connect to the Scheduled Stream
{
@code
HotStream<Data> dataStream = ReactiveSeq.generate(() -> "next job:" + formatDate(new Date())).map(this::processJob)
.schedule("0 20 * * *", Executors.newScheduledThreadPool(1));
data.connect().forEach(this::logToDB);
}
public HotStream<U> scheduleFixedDelay(long delay, java.util.concurrent.ScheduledExecutorService ex)
ReactiveSeq
//run every 60 seconds after last job completes
ReactiveSeq.generate(()->"next job:"+formatDate(new Date()))
.map(this::processJob)
.scheduleFixedDelay(60_000,Executors.newScheduledThreadPool(1));
Connect to the Scheduled Stream
{
@code
HotStream<Data> dataStream = ReactiveSeq.generate(() -> "next job:" + formatDate(new Date())).map(this::processJob)
.scheduleFixedDelay(60_000, Executors.newScheduledThreadPool(1));
data.connect().forEach(this::logToDB);
}
scheduleFixedDelay in interface ReactiveSeq<U>scheduleFixedDelay in interface Foldable<U>delay - Between last element completes passing through the Stream
until the next one startsex - ScheduledExecutorServicepublic HotStream<U> scheduleFixedRate(long rate, java.util.concurrent.ScheduledExecutorService ex)
ReactiveSeq
//run every 60 seconds
ReactiveSeq.generate(()->"next job:"+formatDate(new Date()))
.map(this::processJob)
.scheduleFixedRate(60_000,Executors.newScheduledThreadPool(1));
Connect to the Scheduled Stream
{
@code
HotStream<Data> dataStream = ReactiveSeq.generate(() -> "next job:" + formatDate(new Date())).map(this::processJob)
.scheduleFixedRate(60_000, Executors.newScheduledThreadPool(1));
data.connect().forEach(this::logToDB);
}
scheduleFixedRate in interface ReactiveSeq<U>scheduleFixedRate in interface Foldable<U>rate - Time in millis between job runsex - ScheduledExecutorServicepublic <T> LazyFutureStream<T> unitIterator(java.util.Iterator<T> it)
unitIterator in interface ReactiveSeq<U>unitIterator in interface IterableFunctor<U>public LazyFutureStream<U> append(U value)
append in interface ReactiveSeq<U>append in interface org.jooq.lambda.Seq<U>public LazyFutureStream<U> prepend(U value)
prepend in interface ReactiveSeq<U>prepend in interface org.jooq.lambda.Seq<U>public <T> LazyFutureStream<T> unit(T unit)
public HotStream<U> hotStream(java.util.concurrent.Executor e)
ReactiveSeqReactiveSeq.primedHotStream(Executor).
The generated HotStream is not pausable, for a pausable HotStream @see ReactiveSeq.pausableHotStream(Executor).
Turns this ReactiveSeq into a HotStream, a connectable Stream, being
executed on a thread on the supplied executor, that is producing data
HotStream<Integer> ints = ReactiveSeq.range(0,Integer.MAX_VALUE)
.hotStream(exec)
ints.connect().forEach(System.out::println);
//print out all the ints
//multiple consumers are possible, so other Streams can connect on different Threads
hotStream in interface ReactiveSeq<U>e - Executor to execute this ReactiveSeq onpublic HotStream<U> primedHotStream(java.util.concurrent.Executor e)
ReactiveSeqReactiveSeq.hotStream(Executor).
The generated HotStream is not pausable, for a pausable HotStream @see ReactiveSeq.primedPausableHotStream(Executor).
HotStream<Integer> ints = ReactiveSeq.range(0,Integer.MAX_VALUE) .hotStream(exec) ints.connect().forEach(System.out::println); //print out all the ints - starting when connect is called. //multiple consumers are possible, so other Streams can connect on different Threads
primedHotStream in interface ReactiveSeq<U>public PausableHotStream<U> pausableHotStream(java.util.concurrent.Executor e)
ReactiveSeqReactiveSeq.primedPausableHotStream(Executor).
The generated HotStream is pausable, for a unpausable HotStream (slightly faster execution) @see ReactiveSeq.hotStream(Executor).
HotStream<Integer> ints = ReactiveSeq.range(0,Integer.MAX_VALUE)
.hotStream(exec)
ints.connect().forEach(System.out::println);
ints.pause(); //on a separate thread pause the generating Stream
//print out all the ints
//multiple consumers are possible, so other Streams can connect on different Threads
pausableHotStream in interface ReactiveSeq<U>e - Executor to execute this ReactiveSeq onpublic PausableHotStream<U> primedPausableHotStream(java.util.concurrent.Executor e)
ReactiveSeqReactiveSeq.pausableHotStream(Executor).
The generated HotStream is pausable, for a unpausable HotStream @see ReactiveSeq.primedHotStream(Executor).
HotStream<Integer> ints = ReactiveSeq.range(0,Integer.MAX_VALUE) .hotStream(exec) ints.connect().forEach(System.out::println); //print out all the ints - starting when connect is called. //multiple consumers are possible, so other Streams can connect on different Threads
primedPausableHotStream in interface ReactiveSeq<U>public java.lang.String format()
format in interface org.jooq.lambda.Seq<U>public org.jooq.lambda.Collectable<U> collectable()
CyclopsCollectablecollectable in interface ReactiveSeq<U>collectable in interface IterableFunctor<U>collectable in interface CyclopsCollectable<U>public U foldRight(Monoid<U> reducer)
ReactiveSeq
ReactiveSeq.of("a","b","c").foldRight(Reducers.toString(""));
// "cab"
public <T> T foldRightMapToType(Reducer<T> reducer)
ReactiveSeq
ReactiveSeq.of(1,2,3).foldRightMapToType(Reducers.toString(""));
// "321"
foldRightMapToType in interface ReactiveSeq<U>foldRightMapToType in interface Foldable<U>reducer - Monoid to reduce valuespublic <R> R mapReduce(Reducer<R> reducer)
ReactiveSeq
ReactiveSeq.of("hello","2","world","4").mapReduce(Reducers.toCountInt());
//4
public <R> R mapReduce(java.util.function.Function<? super U,? extends R> mapper, Monoid<R> reducer)
ReactiveSeq
ReactiveSeq.of("one","two","three","four")
.mapReduce(this::toInt,Reducers.toTotalInt());
//10
int toInt(String s){
if("one".equals(s))
return 1;
if("two".equals(s))
return 2;
if("three".equals(s))
return 3;
if("four".equals(s))
return 4;
return -1;
}
public U reduce(Monoid<U> reducer)
ReactiveSeq
ReactiveSeq.of("hello","2","world","4").reduce(Reducers.toString(","));
//hello,2,world,4
public ListX<U> reduce(java.util.stream.Stream<? extends Monoid<U>> reducers)
ReactiveSeq
{
@code
Monoid<Integer> sum = Monoid.of(0, (a, b) -> a + b);
Monoid<Integer> mult = Monoid.of(1, (a, b) -> a * b);
List<Integer> result = ReactiveSeq.of(1, 2, 3, 4).reduce(Arrays.asList(sum, mult).stream());
assertThat(result, equalTo(Arrays.asList(10, 24)));
}
public ListX<U> reduce(java.lang.Iterable<? extends Monoid<U>> reducers)
ReactiveSeq
Monoid<Integer> sum = Monoid.of(0,(a,b)->a+b);
Monoid<Integer> mult = Monoid.of(1,(a,b)->a*b);
List<Integer> result = ReactiveSeq.of(1,2,3,4))
.reduce(Arrays.asList(sum,mult) );
assertThat(result,equalTo(Arrays.asList(10,24)));
public U foldRight(U identity, java.util.function.BinaryOperator<U> accumulator)
ReactiveSeq
assertTrue(ReactiveSeq.of("a","b","c").foldRight("", String::concat).equals("cba"));
public java.util.Optional<U> min(java.util.Comparator<? super U> comparator)
min in interface ReactiveSeq<U>min in interface CyclopsCollectable<U>min in interface java.util.stream.Stream<U>min in interface org.jooq.lambda.Collectable<U>public java.util.Optional<U> max(java.util.Comparator<? super U> comparator)
max in interface ReactiveSeq<U>max in interface CyclopsCollectable<U>max in interface java.util.stream.Stream<U>max in interface org.jooq.lambda.Collectable<U>public long count()
count in interface ReactiveSeq<U>count in interface LazyFutureStream<U>count in interface CyclopsCollectable<U>count in interface java.util.stream.Stream<U>count in interface org.jooq.lambda.Collectable<U>count in interface org.jooq.lambda.Seq<U>public boolean allMatch(java.util.function.Predicate<? super U> c)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5).allMatch(it-> it>0 && it <6),equalTo(true));
allMatch in interface ReactiveSeq<U>allMatch in interface CyclopsCollectable<U>allMatch in interface java.util.stream.Stream<U>allMatch in interface org.jooq.lambda.Collectable<U>c - Predicate to check if all matchpublic boolean anyMatch(java.util.function.Predicate<? super U> c)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5).anyMatch(it-> it.equals(3)),equalTo(true));
anyMatch in interface ReactiveSeq<U>anyMatch in interface CyclopsCollectable<U>anyMatch in interface java.util.stream.Stream<U>anyMatch in interface org.jooq.lambda.Collectable<U>c - Predicate to check if any matchpublic boolean xMatch(int num,
java.util.function.Predicate<? super U> c)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,5,6,7).xMatch(3, i-> i>4 ));
public boolean noneMatch(java.util.function.Predicate<? super U> c)
noneMatch in interface ReactiveSeq<U>noneMatch in interface CyclopsCollectable<U>noneMatch in interface java.util.stream.Stream<U>noneMatch in interface org.jooq.lambda.Collectable<U>public final java.lang.String join()
ReactiveSeq
assertEquals("123".length(),ReactiveSeq.of(1, 2, 3).join().length());
public final java.lang.String join(java.lang.String sep)
ReactiveSeq
assertEquals("1, 2, 3".length(), ReactiveSeq.of(1, 2, 3).join(", ").length());
public java.lang.String join(java.lang.String sep,
java.lang.String start,
java.lang.String end)
ReactiveSeq
assertEquals("^1|2|3$".length(), of(1, 2, 3).join("|", "^", "$").length());
public HeadAndTail<U> headAndTail()
ReactiveSeq
{
@code
ReactiveSeq<String> helloWorld = ReactiveSeq.of("hello", "world", "last");
HeadAndTail<String> headAndTail = helloWorld.headAndTail();
String head = headAndTail.head();
assertThat(head, equalTo("hello"));
ReactiveSeq<String> tail = headAndTail.tail();
assertThat(tail.headAndTail().head(), equalTo("world"));
}
headAndTail in interface ReactiveSeq<U>headAndTail in interface Foldable<U>