public abstract class BaseExtendedStream<T> extends java.lang.Object implements Unwrapable, ReactiveSeq<T>, java.lang.Iterable<T>
ReactiveSeq.Instances| Constructor and Description |
|---|
BaseExtendedStream() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allMatch(java.util.function.Predicate<? super T> c)
True if predicate matches all elements when Monad converted to a Stream
|
AnyMSeq<Witness.reactiveSeq,T> |
anyM() |
boolean |
anyMatch(java.util.function.Predicate<? super T> c)
True if a singleUnsafe element matches when Monad converted to a Stream
|
void |
close() |
<R,A> R |
collect(java.util.stream.Collector<? super T,A,R> collector)
Performs a mutable
reduction operation on the elements of this reactiveStream using a
Collector. |
<R> R |
collect(java.util.function.Supplier<R> supplier,
java.util.function.BiConsumer<R,? super T> accumulator,
java.util.function.BiConsumer<R,R> combiner)
Performs a mutable
reduction operation on the elements of this reactiveStream.
|
protected abstract <R> ReactiveSeq<R> |
createSeq(java.util.stream.Stream<R> rStream) |
ReactiveSeq<T> |
debounce(long time,
java.util.concurrent.TimeUnit t)
Allow one element through per time period, drop all other elements in
that time period
|
boolean |
endsWith(java.util.stream.Stream<T> iterable)
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Stream.of(5,6)));
|
boolean |
endsWithIterable(java.lang.Iterable<T> iterable)
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Arrays.asList(5,6)));
|
abstract ReactiveSeq<T> |
filterLazyPredicate(java.util.function.Supplier<java.util.function.Predicate<? super T>> fn) |
java.util.Optional<T> |
findAny() |
T |
firstValue()
assertThat(ReactiveSeq.of(1,2,3,4)
.map(u->{throw new RuntimeException();})
.recover(e->"hello")
.firstValue(),equalTo("hello"));
|
ReactiveSeq<T> |
fixedDelay(long l,
java.util.concurrent.TimeUnit unit)
emit elements after a fixed delay
|
ReactiveSeq<java.lang.String> |
flatMapBufferedReader(java.util.function.Function<? super T,java.io.BufferedReader> fn) |
ReactiveSeq<java.lang.Character> |
flatMapCharSequence(java.util.function.Function<? super T,java.lang.CharSequence> fn) |
<R> ReactiveSeq<R> |
flatMapCompletableFuture(java.util.function.Function<? super T,java.util.concurrent.CompletableFuture<? extends R>> fn) |
ReactiveSeq<java.lang.String> |
flatMapFile(java.util.function.Function<? super T,java.io.File> fn) |
<R> ReactiveSeq<R> |
flatMapOptional(java.util.function.Function<? super T,java.util.Optional<? extends R>> fn) |
<R> ReactiveSeq<R> |
flatMapStream(java.util.function.Function<? super T,java.util.stream.BaseStream<? extends R,?>> fn)
flatMap operation
|
java.util.stream.DoubleStream |
flatMapToDouble(java.util.function.Function<? super T,? extends java.util.stream.DoubleStream> mapper) |
java.util.stream.IntStream |
flatMapToInt(java.util.function.Function<? super T,? extends java.util.stream.IntStream> mapper) |
java.util.stream.LongStream |
flatMapToLong(java.util.function.Function<? super T,? extends java.util.stream.LongStream> mapper) |
ReactiveSeq<java.lang.String> |
flatMapURL(java.util.function.Function<? super T,java.net.URL> fn) |
T |
foldLeft(Monoid<T> reducer) |
T |
foldLeft(T identity,
java.util.function.BinaryOperator<T> accumulator) |
<T> T |
foldLeftMapToType(Reducer<T> reducer) |
T |
foldRight(Monoid<T> reducer)
ReactiveSeq.of("a","b","c").foldRight(Reducers.toString(""));
// "cab"
|
T |
foldRight(T identity,
java.util.function.BinaryOperator<T> accumulator)
Immutable reduction from right to left
|
<U> U |
foldRight(U seed,
java.util.function.BiFunction<? super T,? super U,? extends U> function)
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
|
void |
forEachOrdered(java.util.function.Consumer<? super T> action) |
HeadAndTail<T> |
headAndTail()
extract head and tail together, where head is expected to be present
Example :
|
boolean |
isParallel() |
ReactiveSeq<T> |
jitter(long l)
Introduce a random jitter / time delay between the emission of elements
|
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());
|
abstract <R> ReactiveSeq<R> |
mapLazyFn(java.util.function.Supplier<java.util.function.Function<? super T,? extends R>> fn) |
<R> R |
mapReduce(java.util.function.Function<? super T,? 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.stream.DoubleStream |
mapToDouble(java.util.function.ToDoubleFunction<? super T> mapper) |
java.util.stream.IntStream |
mapToInt(java.util.function.ToIntFunction<? super T> mapper) |
java.util.stream.LongStream |
mapToLong(java.util.function.ToLongFunction<? super T> mapper) |
java.util.Optional<T> |
max(java.util.Comparator<? super T> comparator)
Get the maximum value by a function.
|
<C extends java.lang.Comparable<? super C>> |
maxBy(java.util.function.Function<? super T,? extends C> f)
Get the maximum value by a function.
|
java.util.Optional<T> |
min(java.util.Comparator<? super T> comparator)
Get the minimum value by a function.
|
<U extends java.lang.Comparable<? super U>> |
minBy(java.util.function.Function<? super T,? extends U> function)
Get the minimum value by a function.
|
boolean |
noneMatch(java.util.function.Predicate<? super T> c) |
ReactiveSeq<T> |
onClose(java.lang.Runnable closeHandler) |
ReactiveSeq<T> |
onePer(long time,
java.util.concurrent.TimeUnit t)
emit one element per time period
|
ReactiveSeq<T> |
parallel() |
java.util.Optional<T> |
reduce(java.util.function.BinaryOperator<T> accumulator)
An equivalent function to
Stream.reduce(BinaryOperator) |
ListX<T> |
reduce(java.lang.Iterable<? extends Monoid<T>> 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.
|
T |
reduce(Monoid<T> reducer)
ReactiveSeq.of("hello","2","world","4").reduce(Reducers.toString(","));
//hello,2,world,4
|
ListX<T> |
reduce(java.util.stream.Stream<? extends Monoid<T>> 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.
|
T |
reduce(T identity,
java.util.function.BinaryOperator<T> accumulator)
An equivalent function to
Stream.reduce(Object, BinaryOperator) |
<U> U |
reduce(U identity,
java.util.function.BiFunction<U,? super T,U> accumulator,
java.util.function.BinaryOperator<U> combiner)
An equivalent function to
Stream.reduce(Object, BiFunction, BinaryOperator) |
ReactiveSeq<T> |
sequential() |
ReactiveSeq<T> |
sorted()
assertThat(ReactiveSeq.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7))); |
boolean |
startsWith(java.util.stream.Stream<T> stream2)
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Stream.of(1,2,3))) |
boolean |
startsWithIterable(java.lang.Iterable<T> iterable)
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Arrays.asList(1,2,3)));
|
ReactiveSeq<T> |
stream()
Convert this ReactiveSeq into a Stream
|
java.lang.Object[] |
toArray() |
<A> A[] |
toArray(java.util.function.IntFunction<A[]> generator) |
java.util.List<T> |
toList()
Collect the collectable into an
ArrayList. |
java.util.Set<T> |
toSet()
Collect the collectable into a
LinkedHashSet. |
ReactiveSeq<T> |
unordered() |
abstract java.util.stream.Stream<T> |
unwrapStream() |
boolean |
xMatch(int num,
java.util.function.Predicate<? super T> c)
Check that there are specified number of matches of predicate in the
Stream
|
ReactiveSeq<T> |
xPer(int x,
long time,
java.util.concurrent.TimeUnit t)
emit x elements per time period
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitunwrap, unwrapIfInstance, unwrapNestedallTypeclasses, allTypeclasses, ambWith, ambWith, append, append, append, appendS, backpressureAware, broadcast, cast, changes, coflatMap, collectAll, collectStream, combinations, combinations, combinationsT, combinationsT, combine, combine, complete, concat, concat, concat, concat, concatDoubles, concatInts, concatLongs, coproduct, count, crossJoin, cycle, cycle, cycle, cycleUntil, cycleWhile, deferred, deferredI, deferredP, deleteBetween, distinct, distinct, doubles, drop, dropRight, dropUntil, dropWhile, duplicate, duplicate, elapsed, elementAt, empty, enqueued, enqueued, enqueued, enqueuedAll, enums, enums, enums, enumsFromTo, fanOut, fanOut, fanOut, fanOutZipIn, fanOutZipIn, fanOutZipIn, fill, filter, filterInts, filterLongs, filterLongs, filterNot, findFirst, findFirstOrError, findOne, flatMap, flatMapAnyM, flatMapDoubles, flatMapI, flatMapInts, flatMapLongs, flatMapP, flatMapP, flatten, flattenI, flattenO, foldJool, foldParallel, foldParallel, forEach, forEach2, forEach2, forEach3, forEach3, forEach4, forEach4, forEachAsync, format, fromCharSequence, fromDoubleStream, fromIntStream, fromIterable, fromIterator, fromList, fromLongStream, fromPublisher, fromSpliterator, fromStream, generate, generate, get, groupBy, grouped, grouped, grouped, grouped, groupedBySizeAndTime, groupedBySizeAndTime, groupedBySizeAndTime, groupedByTime, groupedByTime, groupedByTime, groupedStatefullyUntil, groupedStatefullyUntil, groupedStatefullyWhile, groupedStatefullyWhile, groupedUntil, groupedUntil, groupedWhile, groupedWhile, hotStream, insertAt, insertAtS, intersperse, ints, isEmpty, isReplayable, iterate, iterate, jool, kindCokleisli, kindKleisli, liftM, limit, limit, limitDouble, limitInts, limitLast, limitLongs, limitUntil, limitUntilClosed, limitWhile, limitWhileClosed, longs, map, mapDoubles, mapInts, mapLongs, mapM, merge, mergeP, mergeP, multicast, narrowK, nested, notNull, of, of, ofDoubles, ofInts, ofLongs, ofNullable, ofType, onEmpty, onEmptyGet, onEmptySwitch, onEmptyThrow, oneShotList, oneShotStream, parallel, parallel, parallelFanOut, parallelFanOut, parallelFanOut, parallelFanOutZipIn, parallelFanOutZipIn, parallelFanOutZipIn, partition, pausableHotStream, peek, permutations, permutationsT, prepend, prepend, prepend, prependS, primedHotStream, primedPausableHotStream, print, print, printErr, printOut, product, product, publishTo, publishTo, quadruplicate, quadruplicate, range, range, rangeLong, rangeLong, reactiveSeq, recover, recover, reduce, reduceAll, remove, removeAll, removeAllI, removeAllS, retainAll, retainAllI, retainAllS, retry, retry, reverse, reversedListOf, reversedOf, scanLeft, scanLeft, scanRight, scanRight, schedule, scheduleFixedDelay, scheduleFixedRate, seq, shuffle, shuffle, single, single, singleUnsafe, size, skip, skip, skipDoubles, skipInts, skipLast, skipLongs, skipUntil, skipUntilClosed, skipWhile, skipWhileClosed, slice, sliding, sliding, sorted, sorted, sorted, splitAt, splitAtHead, splitBy, spliterator, subStream, tailRec, take, takeOne, takeRight, takeUntil, takeWhile, timestamp, trampoline, triplicate, triplicate, unfold, unit, unzip, unzip3, unzip4, visit, widen, zip, zip, zip, zip3, zip3, zip4, zip4, zipLatest, zipP, zipP, zipS, zipS, zipWith, zipWithIndex, zipWithP, zipWithSasFunction, foldFuture, foldLazy, foldTry, forEach, forEach, forEach, forEach, forEach, forEachSubscribe, forEachSubscribe, forEachSubscribe, runFuture, runLazy, toListX, toSetX, visitcollectors, commonPrefix, commonSuffix, count, countDistinct, countDistinct, countDistinctBy, countDistinctBy, mode, sum, sumDouble, sumInt, sumLong, to, toMap, toMap, toString, toStringsubscribe, traversable, unitIteratorgroupedStatefullyUntilT, groupedT, groupedUntilT, groupedWhileT, slidingT, slidingTpublic abstract java.util.stream.Stream<T> unwrapStream()
public final ReactiveSeq<T> parallel()
parallel in interface ReactiveSeq<T>parallel in interface java.util.stream.BaseStream<T,java.util.stream.Stream<T>>public boolean endsWithIterable(java.lang.Iterable<T> iterable)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Arrays.asList(5,6)));
endsWithIterable in interface Folds<T>endsWithIterable in interface ReactiveSeq<T>iterable - Values to checkpublic boolean allMatch(java.util.function.Predicate<? super T> c)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5).allMatch(it-> it>0 && it <6),equalTo(true));
allMatch in interface CyclopsCollectable<T>allMatch in interface ReactiveSeq<T>allMatch in interface java.util.stream.Stream<T>c - Predicate to check if all matchpublic boolean anyMatch(java.util.function.Predicate<? super T> c)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4,5).anyMatch(it-> it.equals(3)),equalTo(true));
anyMatch in interface CyclopsCollectable<T>anyMatch in interface ReactiveSeq<T>anyMatch in interface java.util.stream.Stream<T>c - Predicate to check if any matchpublic boolean xMatch(int num,
java.util.function.Predicate<? super T> c)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,5,6,7).xMatch(3, i-> i>4 ));
public final boolean noneMatch(java.util.function.Predicate<? super T> c)
noneMatch in interface CyclopsCollectable<T>noneMatch in interface ReactiveSeq<T>noneMatch in interface java.util.stream.Stream<T>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 final 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 final <U extends java.lang.Comparable<? super U>> java.util.Optional<T> minBy(java.util.function.Function<? super T,? extends U> function)
CyclopsCollectableminBy in interface CyclopsCollectable<T>public final java.util.Optional<T> min(java.util.Comparator<? super T> comparator)
CyclopsCollectablemin in interface CyclopsCollectable<T>min in interface ReactiveSeq<T>min in interface java.util.stream.Stream<T>public final <C extends java.lang.Comparable<? super C>> java.util.Optional<T> maxBy(java.util.function.Function<? super T,? extends C> f)
CyclopsCollectablemaxBy in interface CyclopsCollectable<T>public final java.util.Optional<T> max(java.util.Comparator<? super T> comparator)
CyclopsCollectablemax in interface CyclopsCollectable<T>max in interface ReactiveSeq<T>max in interface java.util.stream.Stream<T>public final HeadAndTail<T> headAndTail()
FoldableTraversable
ReactiveSeq<String> helloWorld = ReactiveSeq.Of("hello","world","last");
HeadAndTail<String> headAndTail = helloWorld.headAndTail();
String head = headAndTail.head();
//head == "hello"
ReactiveSeq<String> tail = headAndTail.tail();
//["world","last]
headAndTail in interface FoldableTraversable<T>headAndTail in interface ReactiveSeq<T>public final java.util.Optional<T> findAny()
findAny in interface Folds<T>findAny in interface ReactiveSeq<T>findAny in interface java.util.stream.Stream<T>
ReactiveSeq.of(1,2,3,4,5).filter(it -> it <3).findAny().get();
//3
(non-deterministic)public final <R> R mapReduce(Reducer<R> reducer)
ReactiveSeq
ReactiveSeq.of("hello","2","world","4").mapReduce(Reducers.toCountInt());
//4
public final <R> R mapReduce(java.util.function.Function<? super T,? 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 <R,A> R collect(java.util.stream.Collector<? super T,A,R> collector)
ReactiveSeqCollector. A Collector
encapsulates the function used as arguments to
ReactiveSeq.collect(Supplier, BiConsumer, BiConsumer), allowing for reuse of
toX strategies and composition of collect operations such as
multiple-level grouping or partitioning.
If the reactiveStream is parallel, and the Collector
is concurrent, and
lazy the reactiveStream is unordered or the collector is
unordered,
applyHKT a concurrent reduction will be performed (see Collector for
details on concurrent reduction.)
This is a terminal operation.
When executed in parallel, multiple intermediate results may be
instantiated, populated, and merged so as to maintain isolation of
mutable data structures. Therefore, even when executed in parallel
with non-thread-safe data structures (such as ArrayList), no
additional synchronization is needed for a parallel reduction.
collect in interface CyclopsCollectable<T>collect in interface ReactiveSeq<T>collect in interface java.util.stream.Stream<T>collector - the Collector describing the reductionReactiveSeq.collect(Supplier, BiConsumer, BiConsumer),
Collectorspublic <R> R collect(java.util.function.Supplier<R> supplier,
java.util.function.BiConsumer<R,? super T> accumulator,
java.util.function.BiConsumer<R,R> combiner)
ReactiveSeqArrayList, and elements are incorporated by updating
the state of the result rather than by replacing the result. This
produces a result equivalent to:
R result = supplier.get();
for (T element : this reactiveStream)
accumulator.accept(result, element);
return result;
Like ReactiveSeq.reduce(Object, BinaryOperator), collect operations
can be parallelized without requiring additional synchronization.
This is a terminal operation.
collect in interface ReactiveSeq<T>collect in interface java.util.stream.Stream<T>supplier - a function that creates a new result container. For a
parallel execution, this function may be called
multiple times and must return a fresh value each time.accumulator - an associative,
non-interfering,
stateless
function for incorporating an additional element into a resultcombiner - an associative,
non-interfering,
stateless
function for combining two values, which must be
compatible with the accumulator functionpublic final T reduce(Monoid<T> reducer)
ReactiveSeq
ReactiveSeq.of("hello","2","world","4").reduce(Reducers.toString(","));
//hello,2,world,4
public <U> U reduce(U identity,
java.util.function.BiFunction<U,? super T,U> accumulator,
java.util.function.BinaryOperator<U> combiner)
FoldsStream.reduce(Object, BiFunction, BinaryOperator)public final ListX<T> reduce(java.util.stream.Stream<? extends Monoid<T>> 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).reactiveStream());
assertThat(result, equalTo(Arrays.asList(10, 24)));
public final ListX<T> reduce(java.lang.Iterable<? extends Monoid<T>> 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 final <T> T foldLeftMapToType(Reducer<T> reducer)
public final T foldRight(Monoid<T> reducer)
ReactiveSeq
ReactiveSeq.of("a","b","c").foldRight(Reducers.toString(""));
// "cab"
public final <U> U foldRight(U seed,
java.util.function.BiFunction<? super T,? super U,? extends U> function)
Foldspublic final <T> T foldRightMapToType(Reducer<T> reducer)
ReactiveSeq
ReactiveSeq.of(1,2,3).foldRightMapToType(Reducers.toString(""));
// "321"
foldRightMapToType in interface Folds<T>foldRightMapToType in interface ReactiveSeq<T>reducer - Monoid to reduce valuespublic final java.util.Set<T> toSet()
CyclopsCollectableLinkedHashSet.toSet in interface CyclopsCollectable<T>toSet in interface ReactiveSeq<T>public final java.util.List<T> toList()
CyclopsCollectableArrayList.toList in interface CyclopsCollectable<T>toList in interface ReactiveSeq<T>public final ReactiveSeq<T> stream()
ReactiveSeqstream in interface Folds<T>stream in interface TransformerTraversable<T>stream in interface ExtendedTraversable<T>stream in interface FoldableTraversable<T>stream in interface Sequential<T>stream in interface Traversable<T>stream in interface ReactiveSeq<T>public final boolean startsWithIterable(java.lang.Iterable<T> iterable)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Arrays.asList(1,2,3)));
startsWithIterable in interface Folds<T>startsWithIterable in interface ReactiveSeq<T>public final boolean startsWith(java.util.stream.Stream<T> stream2)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4).startsWith(Stream.of(1,2,3)))
startsWith in interface Folds<T>startsWith in interface ReactiveSeq<T>stream2 - Stream to check if this Folds has the same elements in the same order, at the skippublic AnyMSeq<Witness.reactiveSeq,T> anyM()
anyM in interface ReactiveSeq<T>public final <R> ReactiveSeq<R> flatMapStream(java.util.function.Function<? super T,java.util.stream.BaseStream<? extends R,?>> fn)
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3)
.flatMapStream(i->IntStream.of(i))
.toList(),equalTo(Arrays.asList(1,2,3)));
flatMapStream in interface ReactiveSeq<T>fn - to be appliedpublic final <R> ReactiveSeq<R> flatMapOptional(java.util.function.Function<? super T,java.util.Optional<? extends R>> fn)
protected abstract <R> ReactiveSeq<R> createSeq(java.util.stream.Stream<R> rStream)
public final <R> ReactiveSeq<R> flatMapCompletableFuture(java.util.function.Function<? super T,java.util.concurrent.CompletableFuture<? extends R>> fn)
public final ReactiveSeq<java.lang.Character> flatMapCharSequence(java.util.function.Function<? super T,java.lang.CharSequence> fn)
public final ReactiveSeq<java.lang.String> flatMapFile(java.util.function.Function<? super T,java.io.File> fn)
public final ReactiveSeq<java.lang.String> flatMapURL(java.util.function.Function<? super T,java.net.URL> fn)
public final ReactiveSeq<java.lang.String> flatMapBufferedReader(java.util.function.Function<? super T,java.io.BufferedReader> fn)
public boolean isParallel()
public ReactiveSeq<T> sequential()
sequential in interface ReactiveSeq<T>sequential in interface java.util.stream.BaseStream<T,java.util.stream.Stream<T>>public ReactiveSeq<T> unordered()
unordered in interface ReactiveSeq<T>unordered in interface java.util.stream.BaseStream<T,java.util.stream.Stream<T>>public java.util.stream.IntStream mapToInt(java.util.function.ToIntFunction<? super T> mapper)
mapToInt in interface Traversable<T>mapToInt in interface ReactiveSeq<T>mapToInt in interface java.util.stream.Stream<T>public java.util.stream.LongStream mapToLong(java.util.function.ToLongFunction<? super T> mapper)
mapToLong in interface Traversable<T>mapToLong in interface ReactiveSeq<T>mapToLong in interface java.util.stream.Stream<T>public java.util.stream.DoubleStream mapToDouble(java.util.function.ToDoubleFunction<? super T> mapper)
mapToDouble in interface Traversable<T>mapToDouble in interface ReactiveSeq<T>mapToDouble in interface java.util.stream.Stream<T>public java.util.stream.IntStream flatMapToInt(java.util.function.Function<? super T,? extends java.util.stream.IntStream> mapper)
flatMapToInt in interface java.util.stream.Stream<T>public java.util.stream.LongStream flatMapToLong(java.util.function.Function<? super T,? extends java.util.stream.LongStream> mapper)
flatMapToLong in interface java.util.stream.Stream<T>public java.util.stream.DoubleStream flatMapToDouble(java.util.function.Function<? super T,? extends java.util.stream.DoubleStream> mapper)
flatMapToDouble in interface java.util.stream.Stream<T>public void forEachOrdered(java.util.function.Consumer<? super T> action)
forEachOrdered in interface java.util.stream.Stream<T>public java.lang.Object[] toArray()
toArray in interface java.util.stream.Stream<T>public <A> A[] toArray(java.util.function.IntFunction<A[]> generator)
toArray in interface java.util.stream.Stream<T>public ReactiveSeq<T> onClose(java.lang.Runnable closeHandler)
onClose in interface ReactiveSeq<T>onClose in interface java.util.stream.BaseStream<T,java.util.stream.Stream<T>>public void close()
public ReactiveSeq<T> xPer(int x, long time, java.util.concurrent.TimeUnit t)
ReactiveSeq
code
SimpleTimer timer = new SimpleTimer();
ReactiveSeq.of(1, 2, 3, 4, 5, 6)
.xPer(6, 100000000, TimeUnit.NANOSECONDS)
.collect(CyclopsCollectors.toList())
.size();
//6
xPer in interface Sequential<T>xPer in interface ReactiveSeq<T>x - number of elements to emittime - periodt - Time unitpublic final ReactiveSeq<T> sorted()
ReactiveSeq
assertThat(ReactiveSeq.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7)));
sorted in interface Traversable<T>sorted in interface ReactiveSeq<T>sorted in interface java.util.stream.Stream<T>public abstract <R> ReactiveSeq<R> mapLazyFn(java.util.function.Supplier<java.util.function.Function<? super T,? extends R>> fn)
public abstract ReactiveSeq<T> filterLazyPredicate(java.util.function.Supplier<java.util.function.Predicate<? super T>> fn)
public ReactiveSeq<T> onePer(long time, java.util.concurrent.TimeUnit t)
ReactiveSeq
ReactiveSeq.iterate("", last -> "next")
.limit(100)
.batchBySize(10)
.onePer(1, TimeUnit.MICROSECONDS)
.peek(batch -> System.out.println("batched : " + batch))
.flatMap(Collection::reactiveStream)
.peek(individual -> System.out.println("Flattened : "
+ individual))
.forEach(a->{});
onePer in interface Sequential<T>onePer in interface ReactiveSeq<T>time - periodt - Time unitpublic ReactiveSeq<T> debounce(long time, java.util.concurrent.TimeUnit t)
ReactiveSeq
ReactiveSeq.of(1,2,3,4,5,6)
.debounce(1000,TimeUnit.SECONDS).toList();
// 1
debounce in interface ReactiveSeq<T>time - Time to applyHKT debouncing overt - Time unit for debounce periodpublic ReactiveSeq<T> fixedDelay(long l, java.util.concurrent.TimeUnit unit)
ReactiveSeq
SimpleTimer timer = new SimpleTimer();
ReactiveSeq.of(1, 2, 3, 4, 5, 6)
.fixedDelay(10000, TimeUnit.NANOSECONDS)
.collect(CyclopsCollectors.toList())
.size();
//6
assertThat(timer.getElapsedNanoseconds(), greaterThan(60000l));
fixedDelay in interface Sequential<T>fixedDelay in interface ReactiveSeq<T>l - time length in nanos of the delayunit - for the delaypublic ReactiveSeq<T> jitter(long l)
ReactiveSeq
{ @code
SimpleTimer timer = new SimpleTimer();
ReactiveSeq.of(1, 2, 3, 4, 5, 6)
.jitter(10000)
.collect(CyclopsCollectors.toList());
assertThat(timer.getElapsedNanoseconds(), greaterThan(20000l));
}
jitter in interface ReactiveSeq<T>l - - random number less than this is used for each jitterpublic T foldRight(T identity, java.util.function.BinaryOperator<T> accumulator)
ReactiveSeq
assertTrue(ReactiveSeq.of("a","b","c").foldRight("", String::concat).equals("cba"));
public boolean endsWith(java.util.stream.Stream<T> iterable)
ReactiveSeq
assertTrue(ReactiveSeq.of(1,2,3,4,5,6)
.endsWith(Stream.of(5,6)));
public T firstValue()
ReactiveSeq
assertThat(ReactiveSeq.of(1,2,3,4)
.map(u->{throw new RuntimeException();})
.recover(e->"hello")
.firstValue(),equalTo("hello"));
firstValue in interface Folds<T>firstValue in interface ReactiveSeq<T>public java.util.Optional<T> reduce(java.util.function.BinaryOperator<T> accumulator)
FoldsStream.reduce(BinaryOperator)
ReactiveSeq.of(1,2,3,4,5).map(it -> it*100).reduce(
(acc,next) -> acc+next)
//Optional[1500]
public T reduce(T identity, java.util.function.BinaryOperator<T> accumulator)
FoldsStream.reduce(Object, BinaryOperator)reduce in interface Folds<T>reduce in interface ReactiveSeq<T>reduce in interface java.util.stream.Stream<T>accumulator - Combiner function