Package com.terracottatech.store.async
Interface AsyncStream<T>
- Type Parameters:
T- the type of the stream elements
- All Superinterfaces:
AutoCloseable,BaseStream<T,AsyncStream<T>>
- All Known Subinterfaces:
AsyncMutableRecordStream<K>,AsyncRecordStream<K>
An asynchronous equivalent to
Stream.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAn asynchronous equivalent toStream.allMatch(java.util.function.Predicate).An asynchronous equivalent toStream.anyMatch(java.util.function.Predicate).<R> Operation<R>collect(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator, BiConsumer<R, R> combiner) An asynchronous equivalent toStream.collect(java.util.function.Supplier, java.util.function.BiConsumer, java.util.function.BiConsumer).<R,A> Operation<R> An asynchronous equivalent toStream.reduce(java.util.function.BinaryOperator).count()An asynchronous equivalent toStream.count().distinct()An asynchronous equivalent toStream.distinct().An asynchronous equivalent toStream.filter(java.util.function.Predicate).findAny()An asynchronous equivalent toStream.findAny().An asynchronous equivalent toStream.findFirst().<R> AsyncStream<R>An asynchronous equivalent toStream.flatMap(java.util.function.Function).flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) An asynchronous equivalent toStream.flatMapToDouble(java.util.function.Function).flatMapToInt(Function<? super T, ? extends IntStream> mapper) An asynchronous equivalent toStream.flatMapToInt(java.util.function.Function).flatMapToLong(Function<? super T, ? extends LongStream> mapper) An asynchronous equivalent toStream.flatMapToLong(java.util.function.Function).An asynchronous equivalent toStream.forEach(java.util.function.Consumer).forEachOrdered(Consumer<? super T> action) An asynchronous equivalent toStream.forEachOrdered(java.util.function.Consumer).limit(long maxSize) An asynchronous equivalent toStream.limit(long).<R> AsyncStream<R>An asynchronous equivalent toStream.map(java.util.function.Function).mapToDouble(ToDoubleFunction<? super T> mapper) An asynchronous equivalent toStream.mapToDouble(java.util.function.ToDoubleFunction).mapToInt(ToIntFunction<? super T> mapper) An asynchronous equivalent toStream.mapToInt(java.util.function.ToIntFunction).mapToLong(ToLongFunction<? super T> mapper) An asynchronous equivalent toStream.mapToLong(java.util.function.ToLongFunction).max(Comparator<? super T> comparator) An asynchronous equivalent toStream.max(java.util.Comparator).min(Comparator<? super T> comparator) An asynchronous equivalent toStream.min(java.util.Comparator).An asynchronous equivalent toStream.noneMatch(java.util.function.Predicate).An asynchronous equivalent toStream.peek(java.util.function.Consumer).reduce(BinaryOperator<T> accumulator) An asynchronous equivalent toStream.reduce(java.util.function.BinaryOperator).reduce(T identity, BinaryOperator<T> accumulator) An asynchronous equivalent toStream.reduce(java.lang.Object, java.util.function.BinaryOperator).<U> Operation<U>reduce(U identity, BiFunction<U, ? super T, U> accumulator, BinaryOperator<U> combiner) An asynchronous equivalent toStream.reduce(java.lang.Object, java.util.function.BiFunction, java.util.function.BinaryOperator).skip(long n) An asynchronous equivalent toStream.skip(long).sorted()An asynchronous equivalent toStream.sorted().sorted(Comparator<? super T> comparator) An asynchronous equivalent toStream.sorted(java.util.Comparator).toArray()An asynchronous equivalent toStream.toArray().<A> Operation<A[]>toArray(IntFunction<A[]> generator) An asynchronous equivalent toStream.toArray(java.util.function.IntFunction).Methods inherited from interface java.util.stream.BaseStream
close, isParallel, iterator, onClose, parallel, sequential, spliterator, unordered
-
Method Details
-
filter
An asynchronous equivalent toStream.filter(java.util.function.Predicate).- Parameters:
predicate- the inclusion predicate- Returns:
- the new stream
-
map
An asynchronous equivalent toStream.map(java.util.function.Function).- Type Parameters:
R- the element type of the new stream- Parameters:
mapper- the element mapping function- Returns:
- the new stream
-
mapToInt
An asynchronous equivalent toStream.mapToInt(java.util.function.ToIntFunction).- Parameters:
mapper- the element mapping function- Returns:
- the new stream
-
mapToLong
An asynchronous equivalent toStream.mapToLong(java.util.function.ToLongFunction).- Parameters:
mapper- the element mapping function- Returns:
- the new stream
-
mapToDouble
An asynchronous equivalent toStream.mapToDouble(java.util.function.ToDoubleFunction).- Parameters:
mapper- the element mapping function- Returns:
- the new stream
-
flatMap
An asynchronous equivalent toStream.flatMap(java.util.function.Function).- Type Parameters:
R- the element type of the new stream- Parameters:
mapper- the element mapping function- Returns:
- the new stream
-
flatMapToInt
An asynchronous equivalent toStream.flatMapToInt(java.util.function.Function).- Parameters:
mapper- the element mapping function- Returns:
- the new stream
-
flatMapToLong
An asynchronous equivalent toStream.flatMapToLong(java.util.function.Function).- Parameters:
mapper- the element mapping function- Returns:
- the new stream
-
flatMapToDouble
An asynchronous equivalent toStream.flatMapToDouble(java.util.function.Function).- Parameters:
mapper- the element mapping function- Returns:
- the new stream
-
distinct
AsyncStream<T> distinct()An asynchronous equivalent toStream.distinct().- Returns:
- the new stream
-
sorted
AsyncStream<T> sorted()An asynchronous equivalent toStream.sorted().- Returns:
- the new stream
-
sorted
An asynchronous equivalent toStream.sorted(java.util.Comparator).- Parameters:
comparator- comparator used to compare the elements- Returns:
- the new stream
-
peek
An asynchronous equivalent toStream.peek(java.util.function.Consumer).- Parameters:
action- action to perform on the elements as they are consumed- Returns:
- the new stream
-
limit
An asynchronous equivalent toStream.limit(long).- Parameters:
maxSize- maximum number of elements- Returns:
- the new stream
-
skip
An asynchronous equivalent toStream.skip(long).- Parameters:
n- number of leading elements to skip- Returns:
- the new stream
-
forEach
An asynchronous equivalent toStream.forEach(java.util.function.Consumer).- Parameters:
action- action to perform on the elements- Returns:
- an
Operationrepresenting the completion of this action across all elements
-
forEachOrdered
An asynchronous equivalent toStream.forEachOrdered(java.util.function.Consumer).- Parameters:
action- action to perform on the elements- Returns:
- an
Operationrepresenting the completion of this action across all elements
-
toArray
An asynchronous equivalent toStream.toArray().- Returns:
- an
Operationrepresenting the conversion of this stream to an array
-
toArray
An asynchronous equivalent toStream.toArray(java.util.function.IntFunction).- Type Parameters:
A- the element type of the array- Parameters:
generator- a generator function for an array of the desired type and length- Returns:
- an
Operationrepresenting the conversion of this stream to an array
-
reduce
An asynchronous equivalent toStream.reduce(java.lang.Object, java.util.function.BinaryOperator).- Parameters:
identity- identity value of the accumulating functionaccumulator- the accumulating function- Returns:
- an
Operationrepresenting the execution of this reduction
-
reduce
An asynchronous equivalent toStream.reduce(java.util.function.BinaryOperator).- Parameters:
accumulator- the accumulating function- Returns:
- an
Operationrepresenting the execution of this reduction
-
reduce
<U> Operation<U> reduce(U identity, BiFunction<U, ? super T, U> accumulator, BinaryOperator<U> combiner) An asynchronous equivalent toStream.reduce(java.lang.Object, java.util.function.BiFunction, java.util.function.BinaryOperator).- Type Parameters:
U- the type of the result- Parameters:
identity- identity value of the accumulating functionaccumulator- the accumulating functioncombiner- the combining function- Returns:
- an
Operationrepresenting the execution of this reduction
-
collect
<R> Operation<R> collect(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator, BiConsumer<R, R> combiner) An asynchronous equivalent toStream.collect(java.util.function.Supplier, java.util.function.BiConsumer, java.util.function.BiConsumer).- Type Parameters:
R- the type of the result- Parameters:
supplier- the result container supplieraccumulator- the accumulating functioncombiner- the combining function- Returns:
- an
Operationrepresenting the execution of this reduction
-
collect
An asynchronous equivalent toStream.reduce(java.util.function.BinaryOperator).- Type Parameters:
R- the type of the resultA- the intermediate accumulation type- Parameters:
collector- theCollectordescribing the operation- Returns:
- an
Operationrepresenting the execution of this reduction
-
min
An asynchronous equivalent toStream.min(java.util.Comparator).- Parameters:
comparator- comparator used to compare elements- Returns:
- an
Operationrepresenting the calculation of the minimum value
-
max
An asynchronous equivalent toStream.max(java.util.Comparator).- Parameters:
comparator- comparator used to compare elements- Returns:
- an
Operationrepresenting the calculation of the maximum value
-
count
An asynchronous equivalent toStream.count().- Returns:
- an
Operationrepresenting the length of the stream
-
anyMatch
An asynchronous equivalent toStream.anyMatch(java.util.function.Predicate).- Parameters:
predicate- predicate to apply to the elements in the stream- Returns:
- an
Operationreturningtrueif at least one elements satisfies the predicate
-
allMatch
An asynchronous equivalent toStream.allMatch(java.util.function.Predicate).- Parameters:
predicate- predicate to apply to the elements in the stream- Returns:
- an
Operationreturningtrueif all the elements satisfy the predicate
-
noneMatch
An asynchronous equivalent toStream.noneMatch(java.util.function.Predicate).- Parameters:
predicate- predicate to apply to the elements in the stream- Returns:
- an
Operationreturningtrueif none of the elements satisfy the predicate
-
findFirst
An asynchronous equivalent toStream.findFirst().- Returns:
- an
Operationreturning the first element of the stream
-
findAny
An asynchronous equivalent toStream.findAny().- Returns:
- an
Operationreturning an element of the stream
-