T
- the element type of this stream@FunctionalInterface public interface EmeticStream<T> extends AutoCloseable
EmeticStream
provides a functional parallel to Stream
, with methods taking checked equivalents of
java.util.function
adjective:
1. (of a substance) causing vomiting.
Modifier and Type | Method and Description |
---|---|
default boolean |
allMatch(CheckedPredicate<? super T,?> predicate) |
default boolean |
anyMatch(CheckedPredicate<? super T,?> predicate) |
default void |
close()
Closes the wrapped stream, invoking all registered close handlers.
|
default <R> R |
collect(CheckedSupplier<R,?> supplier,
CheckedBiConsumer<R,? super T,?> accumulator,
CheckedBiConsumer<R,R,?> combiner) |
default <R,A> R |
collect(Collector<? super T,A,R> collector) |
default long |
count() |
static <T,R> EmeticStream<R> |
emesis(CheckedFunction<T,Stream<R>,?> function,
T value) |
static <T> EmeticStream<T> |
emesis(Stream<T> stream)
Wrap a stream in order to invoke check functions on it
|
default EmeticStream<T> |
filter(CheckedPredicate<? super T,?> predicate) |
default <R> EmeticStream<R> |
flatMap(CheckedFunction<? super T,? extends Stream<? extends R>,?> mapper) |
default DoubleStream |
flatMapToDouble(CheckedFunction<? super T,? extends DoubleStream,?> mapper) |
default IntStream |
flatMapToInt(CheckedFunction<? super T,? extends IntStream,?> mapper) |
default LongStream |
flatMapToLong(CheckedFunction<? super T,? extends LongStream,?> mapper) |
default void |
forEach(CheckedConsumer<? super T,?> action) |
default void |
forEachOrdered(CheckedConsumer<? super T,?> action) |
default boolean |
isParallel()
Returns whether the wrapped stream would execute in parallel, if a terminal operation were executed.
|
default Iterator<T> |
iterator()
Returns an iterator for the elements of the wrapped stream.
|
default <R> EmeticStream<R> |
map(CheckedFunction<? super T,? extends R,?> mapper) |
default DoubleStream |
mapToDouble(CheckedToDoubleFunction<? super T,?> mapper) |
default IntStream |
mapToInt(CheckedToIntFunction<? super T,?> mapper) |
default LongStream |
mapToLong(CheckedToLongFunction<? super T,?> mapper) |
Stream<T> |
mapToStream() |
default Optional<T> |
max(CheckedComparator<? super T,?> comparator) |
default Optional<T> |
min(CheckedComparator<? super T,?> comparator) |
default boolean |
noneMatch(CheckedPredicate<? super T,?> predicate) |
default EmeticStream<T> |
onClose(Runnable closeHandler)
Returns an equivalent stream with the additional close handler.
|
default EmeticStream<T> |
parallel() |
default EmeticStream<T> |
peek(CheckedConsumer<? super T,?> action) |
default Optional<T> |
reduce(CheckedBinaryOperator<T,?> accumulator) |
default T |
reduce(T identity,
CheckedBinaryOperator<T,?> accumulator) |
default EmeticStream<T> |
sequential() |
default EmeticStream<T> |
sorted(CheckedComparator<? super T,?> comparator) |
default Spliterator<T> |
spliterator()
Returns a spliterator for the elements of the wrapped stream.
|
default EmeticStream<T> |
unordered()
Returns an equivalent stream that is unordered.
|
static <T,R> EmeticStream<R> emesis(CheckedFunction<T,Stream<R>,?> function, T value)
T
- the function's argument typeR
- the element type of this streamfunction
- the checked function which, when applied to the value
produces the Stream
to be returnedvalue
- argument for the functionStream
result of applying function
to value
static <T> EmeticStream<T> emesis(Stream<T> stream)
T
- the stream
's element typestream
- the underlying Stream
EmeticStream
default EmeticStream<T> parallel()
BaseStream.parallel()
default EmeticStream<T> sequential()
BaseStream.sequential()
default EmeticStream<T> unordered()
BaseStream.unordered()
default Iterator<T> iterator()
BaseStream.iterator()
default Spliterator<T> spliterator()
BaseStream.spliterator()
default boolean isParallel()
true
if the wrapped stream would execute in parallelBaseStream.isParallel()
default boolean allMatch(CheckedPredicate<? super T,?> predicate)
predicate
- a non-interfering and stateless, checked predicate 𝗣 to apply
to all elements in the stream 𝕊Stream.allMatch(java.util.function.Predicate)
default boolean anyMatch(CheckedPredicate<? super T,?> predicate)
predicate
- a non-interfering and stateless, checked predicate 𝗣 to apply
to all elements in the stream 𝕊Stream.anyMatch(java.util.function.Predicate)
default <R,A> R collect(Collector<? super T,A,R> collector)
A
- mutable accumulator typeR
- reduction result typecollector
- Collector
performing reduction and supplying resultStream.collect(Collector)
default <R> R collect(CheckedSupplier<R,?> supplier, CheckedBiConsumer<R,? super T,?> accumulator, CheckedBiConsumer<R,R,?> combiner)
R
- result typesupplier
- creates a new (potentially partial) result containeraccumulator
- associative, non-interfering, stateless function, adding element to resultcombiner
- combines the accumulated resultsStream.collect(java.util.function.Supplier, java.util.function.BiConsumer, java.util.function.BiConsumer)
default EmeticStream<T> filter(CheckedPredicate<? super T,?> predicate)
predicate
- a non-interfering, stateless predicate determining which elements travel downStream
EmeticStream
Stream.filter(java.util.function.Predicate)
default <R> EmeticStream<R> flatMap(CheckedFunction<? super T,? extends Stream<? extends R>,?> mapper)
R
- element type of the new streammapper
- a non-interfering, stateless function transforming <T>
to Stream<R>
EmeticStream
Stream.flatMap(java.util.function.Function)
default DoubleStream flatMapToDouble(CheckedFunction<? super T,? extends DoubleStream,?> mapper)
mapper
- a non-interfering, stateless function transforming <T>
to DoubleStream
DoubleStream
Stream.flatMapToDouble(java.util.function.Function)
default IntStream flatMapToInt(CheckedFunction<? super T,? extends IntStream,?> mapper)
mapper
- a non-interfering, stateless function transforming <T>
to IntStream
IntStream
Stream.flatMapToInt(java.util.function.Function)
default LongStream flatMapToLong(CheckedFunction<? super T,? extends LongStream,?> mapper)
mapper
- a non-interfering, stateless function transforming <T>
to LongStream
EmeticStream
Stream.flatMapToLong(java.util.function.Function)
default void forEach(CheckedConsumer<? super T,?> action)
action
- a non-interfering action to apply to each elementStream.forEach(java.util.function.Consumer)
default void forEachOrdered(CheckedConsumer<? super T,?> action)
action
- a non-interfering action to apply to each elementStream.forEachOrdered(java.util.function.Consumer)
default <R> EmeticStream<R> map(CheckedFunction<? super T,? extends R,?> mapper)
R
- the element type of returned Stream
mapper
- a non-interfering, stateless function transforming <T>
to <R>
EmeticStream
Stream.map(java.util.function.Function)
default DoubleStream mapToDouble(CheckedToDoubleFunction<? super T,?> mapper)
mapper
- a non-interfering, stateless function transforming <T>
to double
EmeticStream
Stream.mapToDouble(java.util.function.ToDoubleFunction)
default IntStream mapToInt(CheckedToIntFunction<? super T,?> mapper)
mapper
- a non-interfering, stateless function transforming <T>
to int
EmeticStream
Stream.mapToInt(java.util.function.ToIntFunction)
default LongStream mapToLong(CheckedToLongFunction<? super T,?> mapper)
mapper
- a non-interfering, stateless function transforming <T>
to long
EmeticStream
Stream.mapToLong(java.util.function.ToLongFunction)
default Optional<T> max(CheckedComparator<? super T,?> comparator)
comparator
- a non-interfering, stateless comparatorOptional
as per Stream.max(java.util.Comparator)
Stream.max(java.util.Comparator)
default Optional<T> min(CheckedComparator<? super T,?> comparator)
comparator
- a non-interfering, stateless comparatorOptional
as per Stream.max(java.util.Comparator)
Stream.min(java.util.Comparator)
default boolean noneMatch(CheckedPredicate<? super T,?> predicate)
predicate
- a non-interfering, stateless, checked predicate 𝗣 to apply
to all elements in the stream 𝕊Stream.noneMatch(java.util.function.Predicate)
default EmeticStream<T> peek(CheckedConsumer<? super T,?> action)
action
- non-interfering action applied to elements of the underlying StreamStream.peek(java.util.function.Consumer)
default Optional<T> reduce(CheckedBinaryOperator<T,?> accumulator)
accumulator
- an associative, non-interfering and stateless functionStream.reduce(java.util.function.BinaryOperator)
default T reduce(T identity, CheckedBinaryOperator<T,?> accumulator)
identity
- seed value for accumulatoraccumulator
- an associative, non-interfering and stateless functionStream.reduce(Object, java.util.function.BinaryOperator)
default EmeticStream<T> sorted(CheckedComparator<? super T,?> comparator)
comparator
- non-interfering, stateless comparator to sortStream.sorted(java.util.Comparator)
default long count()
Stream.count()
default EmeticStream<T> onClose(Runnable closeHandler)
closeHandler
- A runnable executed when the stream is closedBaseStream.onClose(Runnable)
default void close()
close
in interface AutoCloseable
AutoCloseable.close()
,
BaseStream.unordered()
Copyright © 2016–2018 earcam. All rights reserved.