Package com.landawn.abacus.util
Class ExceptionalStream<T,E extends Exception>
java.lang.Object
com.landawn.abacus.util.ExceptionalStream<T,E>
- Type Parameters:
T
-E
-
- All Implemented Interfaces:
Immutable
,Closeable
,AutoCloseable
- Direct Known Subclasses:
ExceptionalStream.StreamE
@SequentialOnly
@Immutable
public class ExceptionalStream<T,E extends Exception>
extends Object
implements Closeable, Immutable
The Stream will be automatically closed after execution(A terminal method is executed/triggered).
- Since:
- 1.3
- Author:
- Haiyang Li
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
ExceptionalStream.ExceptionalIterator<T,
E extends Exception> The Class ExceptionalIterator.static final class
Deprecated.Mostly it's for android.static final class
ExceptionalStream.StreamE<T,
E extends Exception> -
Method Summary
Modifier and TypeMethodDescription<TT,
EE extends Exception>
ExceptionalStream<TT,EE> __
(Function<? super ExceptionalStream<T, E>, ExceptionalStream<TT, EE>> transfer) acceptIfNotEmpty
(Throwables.Consumer<? super ExceptionalStream<T, E>, E2> action) <E2 extends Exception>
booleanallMatch
(Throwables.Predicate<? super T, E2> predicate) <E2 extends Exception>
booleananyMatch
(Throwables.Predicate<? super T, E2> predicate) append
(ExceptionalStream<T, E> s) append
(Collection<? extends T> c) final ExceptionalStream<T,
E> appendIfEmpty
(Throwables.Supplier<? extends ExceptionalStream<T, E>, ? extends E> supplier) Append if empty.appendIfEmpty
(Collection<? extends T> c) final ExceptionalStream<T,
E> appendIfEmpty
(T... a) <R,
E2 extends Exception>
u.Optional<R>applyIfNotEmpty
(Throwables.Function<? super ExceptionalStream<T, E>, R, E2> func) <R> ContinuableFuture<R>
asyncCall
(Throwables.Function<? super ExceptionalStream<T, E>, R, ? extends Exception> terminalAction) <R> ContinuableFuture<R>
asyncCall
(Throwables.Function<? super ExceptionalStream<T, E>, R, ? extends Exception> terminalAction, Executor executor) asyncRun
(Throwables.Consumer<? super ExceptionalStream<T, E>, ? extends Exception> terminalAction) asyncRun
(Throwables.Consumer<? super ExceptionalStream<T, E>, ? extends Exception> terminalAction, Executor executor) <E2 extends Exception>
u.OptionalDoubleaverageDouble
(Throwables.ToDoubleFunction<? super T, E2> func) <E2 extends Exception>
u.OptionalDoubleaverageInt
(Throwables.ToIntFunction<? super T, E2> func) <E2 extends Exception>
u.OptionalDoubleaverageLong
(Throwables.ToLongFunction<? super T, E2> func) cast()
void
close()
It will be called by terminal operations in final.collapse
(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible) collapse
(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, Throwables.BiFunction<? super T, ? super T, T, ? extends E> mergeFunction) Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.<R> ExceptionalStream<R,
E> collapse
(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, Throwables.Supplier<R, E> supplier, Throwables.BiConsumer<? super R, ? super T, ? extends E> accumulator) <C extends Collection<T>>
ExceptionalStream<C,E> collapse
(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, Supplier<? extends C> supplier) <R,
A> ExceptionalStream<R, E> collapse
(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, Collector<? super T, A, R> collector) <U> ExceptionalStream<U,
E> collapse
(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, U init, Throwables.BiFunction<U, ? super T, U, ? extends E> op) collapse
(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, Throwables.BiFunction<? super T, ? super T, T, ? extends E> mergeFunction) Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.<R> ExceptionalStream<R,
E> collapse
(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, Throwables.Supplier<R, E> supplier, Throwables.BiConsumer<? super R, ? super T, ? extends E> accumulator) <C extends Collection<T>>
ExceptionalStream<C,E> collapse
(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, Supplier<? extends C> supplier) <R,
A> ExceptionalStream<R, E> collapse
(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, Collector<? super T, A, R> collector) Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.<U> ExceptionalStream<U,
E> collapse
(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, U init, Throwables.BiFunction<U, ? super T, U, ? extends E> op) collect
(Throwables.Supplier<R, E2> supplier, Throwables.BiConsumer<? super R, ? super T, E3> accumulator) collect
(Throwables.Supplier<R, E2> supplier, Throwables.BiConsumer<? super R, ? super T, E3> accumulator, Throwables.Function<? super R, ? extends RR, E4> finisher) <R,
A> R <R,
RR, A, E2 extends Exception>
RRcollectAndThen
(Collector<? super T, A, R> collector, Throwables.Function<? super R, ? extends RR, E2> func) Collect and then.static <T,
E extends Exception>
ExceptionalStream<T,E> concat
(ExceptionalStream<? extends T, E>... a) static <T,
E extends Exception>
ExceptionalStream<T,E> static <T,
E extends Exception>
ExceptionalStream<T,E> concat
(Collection<? extends ExceptionalStream<? extends T, E>> c) static <T,
E extends Exception>
ExceptionalStream<T,E> static <T,
E extends Exception>
ExceptionalStream<T,E> concat
(T[]... a) boolean
containsAll
(Collection<? extends T> c) final boolean
containsAll
(T... a) boolean
containsAny
(Collection<? extends T> c) final boolean
containsAny
(T... a) long
count()
<K> ExceptionalStream<Map.Entry<K,
Integer>, E> countBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper) cycled()
cycled
(long times) final ExceptionalStream<T,
E> defaultIfEmpty
(Throwables.Supplier<? extends ExceptionalStream<T, E>, ? extends E> supplier) final ExceptionalStream<T,
E> defaultIfEmpty
(T defaultValue) static <T,
E extends Exception>
ExceptionalStream<T,E> defer
(Throwables.Supplier<? extends ExceptionalStream<? extends T, ? extends E>, ? extends E> supplier) Lazy evaluation.difference
(Collection<?> c) <U> ExceptionalStream<T,
E> difference
(Function<? super T, ? extends U> mapper, Collection<U> c) distinct()
Distinct and filter by occurrences.distinct
(Throwables.BinaryOperator<T, ? extends E> mergeFunction) Distinct and filter by occurrences.distinct
(Throwables.Predicate<? super Long, ? extends E> occurrencesFilter) Distinct and filter by occurrences.<K> ExceptionalStream<T,
E> distinctBy
(Throwables.Function<? super T, K, ? extends E> keyMapper) Distinct by the value mapped fromkeyMapper
.<K> ExceptionalStream<T,
E> distinctBy
(Throwables.Function<? super T, K, ? extends E> keyMapper, Throwables.BinaryOperator<T, ? extends E> mergeFunction) Distinct and filter by occurrences.<K> ExceptionalStream<T,
E> distinctBy
(Throwables.Function<? super T, K, ? extends E> keyMapper, Throwables.Predicate<? super Long, ? extends E> occurrencesFilter) Distinct and filter by occurrences.dropWhile
(Throwables.Predicate<? super T, ? extends E> predicate) dropWhile
(Throwables.Predicate<? super T, ? extends E> predicate, Throwables.Consumer<? super T, ? extends E> actionOnDroppedItem) elementAt
(long position) static <T,
E extends Exception>
ExceptionalStream<T,E> empty()
filter
(Throwables.Predicate<? super T, ? extends E> predicate) filter
(Throwables.Predicate<? super T, ? extends E> predicate, Throwables.Consumer<? super T, ? extends E> actionOnDroppedItem) filterE
(Throwables.Predicate<? super T, ? extends Exception> predicate) <E2 extends Exception>
u.Optional<T>findAny
(Throwables.Predicate<? super T, E2> predicate) Same asfindFirst(Throwables.Predicate)
.<E2 extends Exception>
u.Optional<T>findFirst
(Throwables.Predicate<? super T, E2> predicate) <E2 extends Exception>
u.Optional<T>findFirstOrAny
(Throwables.Predicate<? super T, E2> predicateForFirst) Returns the first element matched bypredicateForFirst
if found or the first element if this stream is not empty Otherwise an emptyOptional<T>
will be returned.<E2 extends Exception,
E3 extends Exception>
u.Optional<T>findFirstOrAny
(Throwables.Predicate<? super T, E2> predicateForFirst, Throwables.Predicate<? super T, E3> predicateForAny) Returns the first element matched bypredicateForFirst
if found or the first element matched bypredicateForAny
.<E2 extends Exception>
u.Optional<T>findFirstOrLast
(Throwables.Predicate<? super T, E2> predicateForFirst) Returns the first element matched bypredicateForFirst
if found or the last element if this stream is not empty Otherwise an emptyOptional<T>
will be returned.<E2 extends Exception>
u.Optional<T>findLast
(Throwables.Predicate<? super T, E2> predicate) Consider using:stream.reversed().findFirst(predicate)
for better performance if possible.first()
<R> ExceptionalStream<R,
E> flatmap
(Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends E> mapper) <R> ExceptionalStream<R,
E> flatMap
(Throwables.Function<? super T, ? extends ExceptionalStream<? extends R, ? extends E>, ? extends E> mapper) <R> ExceptionalStream<R,
Exception> flatMapE
(Throwables.Function<? super T, ? extends ExceptionalStream<? extends R, ? extends Exception>, ? extends Exception> mapper) <R> ExceptionalStream<R,
E> flatMapp
(Throwables.Function<? super T, R[], ? extends E> mapper) flatMapToBoolean
(Throwables.Function<? super T, boolean[], ? extends E> mapper) flatMapToByte
(Throwables.Function<? super T, byte[], ? extends E> mapper) flatMapToChar
(Throwables.Function<? super T, char[], ? extends E> mapper) flatMapToDouble
(Throwables.Function<? super T, double[], ? extends E> mapper) flatMapToFloat
(Throwables.Function<? super T, float[], ? extends E> mapper) flatMapToInteger
(Throwables.Function<? super T, int[], ? extends E> mapper) flatMapToLong
(Throwables.Function<? super T, long[], ? extends E> mapper) flatMapToShort
(Throwables.Function<? super T, short[], ? extends E> mapper) <R> ExceptionalStream<R,
E> flattMap
(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E> mapper) <R> ExceptionalStream<R,
Exception> flattMapE
(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception> mapper) <R> ExceptionalStream<R,
E> flattMapIfNotNull
(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E> mapper) <U,
R> ExceptionalStream<R, E> flattMapIfNotNull
(Throwables.Function<? super T, ? extends Collection<? extends U>, ? extends E> mapper, Throwables.Function<? super U, ? extends Collection<? extends R>, ? extends E> mapper2) <E2 extends Exception>
voidforEach
(Throwables.Consumer<? super T, E2> action) forEach
(Throwables.Consumer<? super T, E2> action, Throwables.Runnable<E3> onComplete) forEach
(Throwables.Function<? super T, ? extends Collection<? extends U>, E2> flatMapper, Throwables.BiConsumer<? super T, ? super U, E3> action) forEach
(Throwables.Function<? super T, ? extends Collection<T2>, E2> flatMapper, Throwables.Function<? super T2, ? extends Collection<T3>, E3> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E4> action) <E2 extends Exception>
voidforEachIndexed
(Throwables.IndexedConsumer<? super T, E2> action) <E2 extends Exception>
voidforEachInParallel
(Throwables.Consumer<? super T, E2> action, int threadNum) <E2 extends Exception>
voidforEachInParallel
(Throwables.Consumer<? super T, E2> action, int threadNum, Executor executor) <E2 extends Exception>
voidforEachPair
(Throwables.BiConsumer<? super T, ? super T, E2> action) For each pair.<E2 extends Exception>
voidforEachPair
(Throwables.BiConsumer<? super T, ? super T, E2> action, int increment) For each pair.<E2 extends Exception>
voidforEachTriple
(Throwables.TriConsumer<? super T, ? super T, ? super T, E2> action) For each triple.<E2 extends Exception>
voidforEachTriple
(Throwables.TriConsumer<? super T, ? super T, ? super T, E2> action, int increment) For each triple.<E2 extends Exception>
voidforEachUntil
(MutableBoolean flagToBreak, Throwables.Consumer<? super T, E2> action) <E2 extends Exception>
voidforEachUntil
(Throwables.BiConsumer<? super T, MutableBoolean, E2> action) static <T,
E extends Exception>
ExceptionalStream<T,E> from
(Throwables.Supplier<? extends Collection<? extends T>, ? extends E> supplier) Lazy evaluation.static <T,
E extends Exception>
ExceptionalStream<T,E> generate
(Throwables.Supplier<T, E> supplier) <K> ExceptionalStream<Map.Entry<K,
List<T>>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper) <K,
V> ExceptionalStream<Map.Entry<K, List<V>>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper) <K,
V> ExceptionalStream<Map.Entry<K, V>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Throwables.BinaryOperator<V, ? extends E> mergeFunction) <K,
V> ExceptionalStream<Map.Entry<K, V>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Throwables.BinaryOperator<V, ? extends E> mergeFunction, Supplier<? extends Map<K, V>> mapFactory) <K,
V> ExceptionalStream<Map.Entry<K, List<V>>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Supplier<? extends Map<K, List<V>>> mapFactory) <K,
V, A, D> ExceptionalStream<Map.Entry<K, D>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Collector<? super V, A, D> downstream) <K,
V, A, D> ExceptionalStream<Map.Entry<K, D>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Collector<? super V, A, D> downstream, Supplier<? extends Map<K, D>> mapFactory) <K> ExceptionalStream<Map.Entry<K,
List<T>>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Supplier<? extends Map<K, List<T>>> mapFactory) <K,
A, D> ExceptionalStream<Map.Entry<K, D>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Collector<? super T, A, D> downstream) <K,
A, D> ExceptionalStream<Map.Entry<K, D>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Collector<? super T, A, D> downstream, Supplier<? extends Map<K, D>> mapFactory) groupTo
(Throwables.Function<? super T, ? extends K, E2> keyMapper) groupTo
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper) groupTo
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Supplier<? extends M> mapFactory) groupTo
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Collector<? super V, A, D> downstream) groupTo
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Collector<? super V, A, D> downstream, Supplier<? extends M> mapFactory) groupTo
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Supplier<? extends M> mapFactory) groupTo
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Collector<? super T, A, D> downstream) groupTo
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Collector<? super T, A, D> downstream, Supplier<? extends M> mapFactory) boolean
indexed()
<U> ExceptionalStream<T,
E> intersection
(Throwables.Function<? super T, ? extends U, E> mapper, Collection<U> c) intersection
(Collection<?> c) intersperse
(T delimiter) static <T,
E extends Exception>
ExceptionalStream<T,E> iterate
(Throwables.BooleanSupplier<? extends E> hasNext, Throwables.Supplier<? extends T, E> next) static <T,
E extends Exception>
ExceptionalStream<T,E> iterate
(T init, Throwables.BooleanSupplier<? extends E> hasNext, Throwables.UnaryOperator<T, ? extends E> f) static <T,
E extends Exception>
ExceptionalStream<T,E> iterate
(T init, Throwables.Predicate<? super T, ? extends E> hasNext, Throwables.UnaryOperator<T, ? extends E> f) static <T,
E extends Exception>
ExceptionalStream<T,E> iterate
(T init, Throwables.UnaryOperator<T, ? extends E> f) join
(CharSequence delimiter) join
(CharSequence delimiter, CharSequence prefix, CharSequence suffix) static <T,
E extends Exception>
ExceptionalStream<T,E> just
(T e) static <T,
E extends Exception>
ExceptionalStream<T,E> kthLargest
(int k, Comparator<? super T> comparator) last()
last
(int n) A queue with size up ton
will be maintained to filter out the lastn
elements.limit
(long maxSize) static ExceptionalStream<String,
IOException> static ExceptionalStream<String,
IOException> static ExceptionalStream<String,
IOException> static ExceptionalStream<String,
IOException> static ExceptionalStream<String,
IOException> static ExceptionalStream<File,
IOException> static ExceptionalStream<File,
IOException> <U> ExceptionalStream<U,
E> map
(Throwables.Function<? super T, ? extends U, ? extends E> mapper) <U> ExceptionalStream<U,
Exception> mapE
(Throwables.Function<? super T, ? extends U, ? extends Exception> mapper) mapFirst
(Throwables.Function<? super T, ? extends T, ? extends E> mapperForFirst) <R> ExceptionalStream<R,
E> mapFirstOrElse
(Throwables.Function<? super T, ? extends R, E> mapperForFirst, Throwables.Function<? super T, ? extends R, E> mapperForElse) mapLast
(Throwables.Function<? super T, ? extends T, ? extends E> mapperForLast) <R> ExceptionalStream<R,
E> mapLastOrElse
(Throwables.Function<? super T, ? extends R, E> mapperForLast, Throwables.Function<? super T, ? extends R, E> mapperForElse) <R> ExceptionalStream<R,
E> mapMulti
(Throwables.BiConsumer<? super T, ? super Consumer<R>, ? extends E> mapper) <R> ExceptionalStream<R,
E> mapPartial
(Throwables.Function<? super T, u.Optional<? extends R>, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamex<R> ExceptionalStream<R,
E> mapPartialJdk
(Throwables.Function<? super T, Optional<? extends R>, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamexmapPartialToDouble
(Throwables.Function<? super T, u.OptionalDouble, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamexmapPartialToDoubleJdk
(Throwables.Function<? super T, OptionalDouble, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamexmapPartialToInt
(Throwables.Function<? super T, u.OptionalInt, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamexmapPartialToIntJdk
(Throwables.Function<? super T, OptionalInt, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamexmapPartialToLong
(Throwables.Function<? super T, u.OptionalLong, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamexmapPartialToLongJdk
(Throwables.Function<? super T, OptionalLong, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamexmax
(Comparator<? super T> comparator) maxBy
(Function<? super T, ? extends Comparable> keyMapper) static <T,
E extends Exception>
ExceptionalStream<T,E> merge
(ExceptionalStream<? extends T, E> a, ExceptionalStream<? extends T, E> b, ExceptionalStream<? extends T, E> c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) static <T,
E extends Exception>
ExceptionalStream<T,E> merge
(ExceptionalStream<? extends T, E> a, ExceptionalStream<? extends T, E> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) static <T,
E extends Exception>
ExceptionalStream<T,E> merge
(Iterable<? extends T> a, Iterable<? extends T> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) static <T,
E extends Exception>
ExceptionalStream<T,E> merge
(Iterable<? extends T> a, Iterable<? extends T> b, Iterable<? extends T> c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) static <T,
E extends Exception>
ExceptionalStream<T,E> merge
(Iterator<? extends T> a, Iterator<? extends T> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) static <T,
E extends Exception>
ExceptionalStream<T,E> merge
(Iterator<? extends T> a, Iterator<? extends T> b, Iterator<? extends T> c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) static <T,
E extends Exception>
ExceptionalStream<T,E> merge
(T[] a, T[] b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) static <T,
E extends Exception>
ExceptionalStream<T,E> merge
(T[] a, T[] b, T[] c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) mergeWith
(ExceptionalStream<? extends T, E> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) mergeWith
(Collection<? extends T> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) min
(Comparator<? super T> comparator) minBy
(Function<? super T, ? extends Comparable> keyMapper) <E2 extends Exception>
booleannMatch
(long atLeast, long atMost, Throwables.Predicate<? super T, E2> predicate) <E2 extends Exception>
booleannoneMatch
(Throwables.Predicate<? super T, E2> predicate) static <E extends Exception>
ExceptionalStream<Boolean,E> of
(boolean[] a) static <E extends Exception>
ExceptionalStream<Byte,E> of
(byte[] a) static <E extends Exception>
ExceptionalStream<Character,E> of
(char[] a) static <E extends Exception>
ExceptionalStream<Double,E> of
(double[] a) static <E extends Exception>
ExceptionalStream<Float,E> of
(float[] a) static <E extends Exception>
ExceptionalStream<Integer,E> of
(int[] a) static <E extends Exception>
ExceptionalStream<Long,E> of
(long[] a) static <E extends Exception>
ExceptionalStream<Short,E> of
(short[] a) static <T,
E extends Exception>
ExceptionalStream<T,E> static <T,
E extends Exception>
ExceptionalStream<T,E> static <T,
E extends Exception>
ExceptionalStream<T,E> of
(u.Optional<T> op) static <T,
E extends Exception>
ExceptionalStream<T,E> static <T,
E extends Exception>
ExceptionalStream<T,E> static <T,
E extends Exception>
ExceptionalStream<T,E> of
(Collection<? extends T> c) static <T,
E extends Exception>
ExceptionalStream<T,E> of
(Collection<? extends T> c, Class<E> exceptionType) static <T,
E extends Exception>
ExceptionalStream<T,E> static <T,
E extends Exception>
ExceptionalStream<T,E> static <K,
V, E extends Exception>
ExceptionalStream<Map.Entry<K,V>, E> static <K,
V, E extends Exception>
ExceptionalStream<Map.Entry<K,V>, E> static <T,
E extends Exception>
ExceptionalStream<T,E> static <T,
E extends Exception>
ExceptionalStream<T,E> static <T,
E extends Exception>
ExceptionalStream<T,E> static <T,
E extends Exception>
ExceptionalStream<T,E> of
(T... a) static <K,
E extends Exception>
ExceptionalStream<K,E> static <K,
V, E extends Exception>
ExceptionalStream<K,E> ofKeys
(Map<K, V> map, Throwables.BiPredicate<? super K, ? super V, E> filter) static <K,
V, E extends Exception>
ExceptionalStream<K,E> ofKeys
(Map<K, V> map, Throwables.Predicate<? super V, E> valueFilter) static <T,
E extends Exception>
ExceptionalStream<T,E> ofNullable
(T e) Returns an emptyStream
if the specifiedt
is null.static <V,
E extends Exception>
ExceptionalStream<V,E> static <K,
V, E extends Exception>
ExceptionalStream<V,E> ofValues
(Map<K, V> map, Throwables.BiPredicate<? super K, ? super V, E> filter) static <K,
V, E extends Exception>
ExceptionalStream<V,E> ofValues
(Map<K, V> map, Throwables.Predicate<? super K, E> keyFilter) onClose
(Throwables.Runnable<? extends E> closeHandler) onEach
(Throwables.Consumer<? super T, ? extends E> action) onEachE
(Throwables.Consumer<? super T, ? extends Exception> action) onErrorContinue
(Throwables.Consumer<? super Throwable, ? extends E> errorConsumer) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well.onErrorContinue
(Throwables.Predicate<? super Throwable, ? extends E> errorPredicate, Throwables.Consumer<? super Throwable, ? extends E> errorConsumer) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well.onErrorContinue
(Throwables.Predicate<? super Throwable, ? extends E> errorPredicate, Throwables.Consumer<? super Throwable, ? extends E> errorConsumer, int maxErrorCountToStop) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well.onErrorContinue
(Class<? extends Throwable> type, Throwables.Consumer<? super Throwable, ? extends E> errorConsumer) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well.onErrorReturn
(Throwables.Predicate<? super Throwable, ? extends E> predicate, Throwables.Function<? super Throwable, ? extends T, ? extends E> mapperForFallbackValue, int maxErrorCountToStop) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well.onErrorReturn
(Throwables.Predicate<? super Throwable, ? extends E> predicate, Throwables.Supplier<? extends T, ? extends E> supplierForFallbackValue) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well.onErrorReturn
(Throwables.Predicate<? super Throwable, ? extends E> predicate, T fallbackValue) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well.onErrorReturn
(Class<? extends Throwable> type, T fallbackValue) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well.onErrorReturn
(T fallbackValue) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well.onlyOne()
partitionBy
(Throwables.Predicate<? super T, E> predicate) <A,
D> ExceptionalStream<Map.Entry<Boolean, D>, E> partitionBy
(Throwables.Predicate<? super T, E> predicate, Collector<? super T, A, D> downstream) partitionTo
(Throwables.Predicate<? super T, E2> predicate) partitionTo
(Throwables.Predicate<? super T, E2> predicate, Collector<? super T, A, D> downstream) peek
(Throwables.Consumer<? super T, ? extends E> action) peekFirst
(Throwables.Consumer<? super T, ? extends E> action) peekIf
(Throwables.Predicate<? super T, E> predicate, Throwables.Consumer<? super T, E> action) peekLast
(Throwables.Consumer<? super T, ? extends E> action) percentiles
(Comparator<? super T> comparator) long
persist
(Throwables.BiConsumer<? super T, Writer, IOException> writeLine, File file) long
persist
(Throwables.BiConsumer<? super T, Writer, IOException> writeLine, Writer writer) long
persist
(Throwables.BiConsumer<? super T, Writer, IOException> writeLine, String header, String tail, File file) long
persist
(Throwables.BiConsumer<? super T, Writer, IOException> writeLine, String header, String tail, Writer writer) long
persist
(Throwables.Function<? super T, String, IOException> toLine, File file) toCSV:long
persist
(Throwables.Function<? super T, String, IOException> toLine, OutputStream os) long
persist
(Throwables.Function<? super T, String, IOException> toLine, Writer writer) toCSV:long
persist
(Throwables.Function<? super T, String, IOException> toLine, String header, String tail, File file) long
persist
(Throwables.Function<? super T, String, IOException> toLine, String header, String tail, Writer writer) long
long
long
persist
(Connection conn, String insertSQL, int batchSize, int batchInterval, Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) long
persist
(PreparedStatement stmt, int batchSize, int batchInterval, Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) long
persistToCSV
(File file) Each line in the output file/Writer is an array of JSON String without root bracket.long
Each line in the output file/Writer is an array of JSON String without root bracket.long
persistToCSV
(Writer writer) Each line in the output file/Writer is an array of JSON String without root bracket.long
persistToCSV
(Collection<String> csvHeaders, File file) Each line in the output file/Writer is an array of JSON String without root bracket.long
persistToCSV
(Collection<String> csvHeaders, OutputStream os) Each line in the output file/Writer is an array of JSON String without root bracket.long
persistToCSV
(Collection<String> csvHeaders, Writer writer) Each line in the output file/Writer is an array of JSON String without root bracket.prepend
(ExceptionalStream<T, E> s) prepend
(Collection<? extends T> c) final ExceptionalStream<T,
E> void
println()
static <E extends Exception>
ExceptionalStream<Integer,E> range
(int startInclusive, int endExclusive) static <E extends Exception>
ExceptionalStream<Integer,E> range
(int startInclusive, int endExclusive, int by) static <E extends Exception>
ExceptionalStream<Integer,E> rangeClosed
(int startInclusive, int endExclusive) static <E extends Exception>
ExceptionalStream<Integer,E> rangeClosed
(int startInclusive, int endExclusive, int by) rateLimited
(double permitsPerSecond) rateLimited
(RateLimiter rateLimiter) <E2 extends Exception>
u.Optional<T>reduce
(Throwables.BinaryOperator<T, E2> accumulator) <U,
E2 extends Exception>
Ureduce
(U identity, Throwables.BiFunction<U, ? super T, U, E2> accumulator) <E2 extends Exception>
u.Optional<T>reduceUntil
(Throwables.BinaryOperator<T, E2> accumulator, Throwables.Predicate<? super T, E2> conditionToBreak) <U,
E2 extends Exception>
UreduceUntil
(U identity, Throwables.BiFunction<U, ? super T, U, E2> accumulator, Throwables.Predicate<? super U, E2> conditionToBreak) static <T,
E extends Exception>
ExceptionalStream<T,E> repeat
(T element, long n) reversed()
reverseSorted
(Comparator<? super T> comparator) rotated
(int distance) <U> ExceptionalStream<U,
E> scan
(U init, Throwables.BiFunction<U, ? super T, U, ? extends E> accumulator) <U> ExceptionalStream<U,
E> scan
(U init, Throwables.BiFunction<U, ? super T, U, ? extends E> accumulator, boolean initIncluded) shuffled()
skip
(long n) skipLast
(int n) skipNull()
skipUntil
(Throwables.Predicate<? super T, ? extends E> predicate) sliding
(int windowSize, int increment) <C extends Collection<T>>
ExceptionalStream<C,E> sliding
(int windowSize, int increment, IntFunction<? extends C> collectionSupplier) <A,
R> ExceptionalStream<R, E> <R> ExceptionalStream<R,
E> slidingMap
(Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper) <R> ExceptionalStream<R,
E> slidingMap
(Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper, int increment) <R> ExceptionalStream<R,
E> slidingMap
(Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper, int increment, boolean ignoreNotPaired) <R> ExceptionalStream<R,
E> slidingMap
(Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper) <R> ExceptionalStream<R,
E> slidingMap
(Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper, int increment) <R> ExceptionalStream<R,
E> slidingMap
(Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper, int increment, boolean ignoreNotPaired) slidingToList
(int windowSize, int increment) Sliding to list.slidingToSet
(int windowSize, int increment) Sliding to set.sorted()
sorted
(Comparator<? super T> comparator) sortedBy
(Function<? super T, ? extends Comparable> keyMapper) split
(int chunkSize) <C extends Collection<T>>
ExceptionalStream<C,E> split
(int chunkSize, IntFunction<? extends C> collectionSupplier) Returns ExceptionalStream ofC
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).<R,
A> ExceptionalStream<R, E> static <E extends Exception>
ExceptionalStream<String,E> split
(CharSequence str, CharSequence delimiter) splitAt
(int where) splitAt
(Throwables.Predicate<? super T, ? extends E> where) splitToList
(int chunkSize) Returns ExceptionalStream ofList<T>
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).splitToSet
(int chunkSize) Returns ExceptionalStream ofSet<T>
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).<R> ExceptionalStream<R,
E> Temporarily switch the stream to parallel stream for operationops
and then switch back to sequence stream.<R> ExceptionalStream<R,
E> Temporarily switch the stream to parallel stream for operationops
and then switch back to sequence stream.spsFilter
(int maxThreadNum, Throwables.Predicate<? super T, E> predicate) Temporarily switch the stream to parallel stream for operationfilter
and then switch back to sequence stream.spsFilter
(Throwables.Predicate<? super T, E> predicate) Temporarily switch the stream to parallel stream for operationfilter
and then switch back to sequence stream.spsFilterE
(int maxThreadNum, Throwables.Predicate<? super T, ? extends Exception> predicate) Temporarily switch the stream to parallel stream for operationfilter
and then switch back to sequence stream.spsFilterE
(Throwables.Predicate<? super T, ? extends Exception> predicate) Temporarily switch the stream to parallel stream for operationfilter
and then switch back to sequence stream.<R> ExceptionalStream<R,
E> spsFlatMap
(int maxThreadNum, Throwables.Function<? super T, ? extends Stream<? extends R>, E> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.<R> ExceptionalStream<R,
E> spsFlatMap
(Throwables.Function<? super T, ? extends Stream<? extends R>, E> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.<R> ExceptionalStream<R,
Exception> spsFlatMapE
(int maxThreadNum, Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.<R> ExceptionalStream<R,
Exception> spsFlatMapE
(Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.<R> ExceptionalStream<R,
E> spsFlattMap
(int maxThreadNum, Throwables.Function<? super T, ? extends Collection<? extends R>, E> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.<R> ExceptionalStream<R,
E> spsFlattMap
(Throwables.Function<? super T, ? extends Collection<? extends R>, E> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.<R> ExceptionalStream<R,
Exception> spsFlattMapE
(int maxThreadNum, Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.<R> ExceptionalStream<R,
Exception> spsFlattMapE
(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.<R> ExceptionalStream<R,
E> spsMap
(int maxThreadNum, Throwables.Function<? super T, ? extends R, E> mapper) Temporarily switch the stream to parallel stream for operationmap
and then switch back to sequence stream.<R> ExceptionalStream<R,
E> spsMap
(Throwables.Function<? super T, ? extends R, E> mapper) Temporarily switch the stream to parallel stream for operationmap
and then switch back to sequence stream.<U> ExceptionalStream<U,
Exception> spsMapE
(int maxThreadNum, Throwables.Function<? super T, ? extends U, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationmap
and then switch back to sequence stream.<U> ExceptionalStream<U,
Exception> spsMapE
(Throwables.Function<? super T, ? extends U, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationmap
and then switch back to sequence stream.spsOnEach
(int maxThreadNum, Throwables.Consumer<? super T, E> action) Temporarily switch the stream to parallel stream for operationonEach
and then switch back to sequence stream.spsOnEach
(Throwables.Consumer<? super T, E> action) Temporarily switch the stream to parallel stream for operationonEach
and then switch back to sequence stream.spsOnEachE
(int maxThreadNum, Throwables.Consumer<? super T, ? extends Exception> action) Temporarily switch the stream to parallel stream for operationonEach
and then switch back to sequence stream.spsOnEachE
(Throwables.Consumer<? super T, ? extends Exception> action) Temporarily switch the stream to parallel stream for operationonEach
and then switch back to sequence stream.step
(long step) <E2 extends Exception>
doublesumDouble
(Throwables.ToDoubleFunction<? super T, E2> func) <E2 extends Exception>
longsumInt
(Throwables.ToIntFunction<? super T, E2> func) <E2 extends Exception>
longsumLong
(Throwables.ToLongFunction<? super T, E2> func) takeWhile
(Throwables.Predicate<? super T, ? extends E> predicate) throwIfEmpty
(Supplier<? extends E> exceptionSupplier) Object[]
toArray()
<A> A[]
toArray
(IntFunction<A[]> generator) <C extends Collection<T>>
CtoCollection
(Supplier<? extends C> supplier) <R,
CC extends Collection<T>, E2 extends Exception>
RtoCollectionAndThen
(Supplier<? extends CC> supplier, Throwables.Function<? super CC, R, E2> func) The first row will be used as column names if its type is array or list, or obtain the column names from first row if its type is entity or map.If the specifiedcolumnNames
is null or empty, the first row will be used as column names if its type is array or list, or obtain the column names from first row if its type is entity or map.<K,
V, E2 extends Exception, E3 extends Exception>
ImmutableMap<K,V> toImmutableMap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper) <K,
V, E2 extends Exception, E3 extends Exception, E4 extends Exception>
ImmutableMap<K,V> toImmutableMap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Throwables.BinaryOperator<V, E4> mergeFunction) toList()
<R,
E2 extends Exception>
RtoListAndThen
(Throwables.Function<? super List<T>, R, E2> func) toLongMultiset
(Supplier<? extends LongMultiset<T>> supplier) toMap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper) toMap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Throwables.BinaryOperator<V, E4> mergeFunction) toMap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Throwables.BinaryOperator<V, E4> mergeFunction, Supplier<? extends M> mapFactory) toMap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Supplier<? extends M> mapFactory) toMap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Collector<? super V, A, D> downstream) Deprecated.replaced bygroupTo
toMap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Collector<? super V, A, D> downstream, Supplier<? extends M> mapFactory) Deprecated.replaced bygroupTo
toMap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Collector<? super T, A, D> downstream) Deprecated.replaced bygroupTo
toMap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Collector<? super T, A, D> downstream, Supplier<? extends M> mapFactory) Deprecated.replaced bygroupTo
<K,
E2 extends Exception>
ListMultimap<K,T> toMultimap
(Throwables.Function<? super T, ? extends K, E2> keyMapper) <K,
V, E2 extends Exception, E3 extends Exception>
ListMultimap<K,V> toMultimap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper) <K,
V, C extends Collection<V>, M extends Multimap<K, V, C>, E2 extends Exception, E3 extends Exception>
MtoMultimap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Supplier<? extends M> mapFactory) <K,
V extends Collection<T>, M extends Multimap<K, T, V>, E2 extends Exception>
MtoMultimap
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Supplier<? extends M> mapFactory) toMultiset
(Supplier<? extends Multiset<T>> supplier) top
(int n) top
(int n, Comparator<? super T> comparator) toSet()
<R,
E2 extends Exception>
RtoSetAndThen
(Throwables.Function<? super Set<T>, R, E2> func) static <A,
B, T, E extends Exception>
ExceptionalStream<T,E> zip
(A[] a, B[] b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" iterators until all of them runs out of values.static <A,
B, C, T, E extends Exception>
ExceptionalStream<T,E> zip
(A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" iterators until all of them runs out of values.static <A,
B, C, T, E extends Exception>
ExceptionalStream<T,E> zip
(A[] a, B[] b, C[] c, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" arrays until one of them runs out of values.static <A,
B, T, E extends Exception>
ExceptionalStream<T,E> zip
(A[] a, B[] b, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" arrays until one of them runs out of values.static <A,
B, T, E extends Exception>
ExceptionalStream<T,E> zip
(ExceptionalStream<? extends A, E> a, ExceptionalStream<? extends B, E> b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" streams until one of them runs out of values.static <A,
B, C, T, E extends Exception>
ExceptionalStream<T,E> zip
(ExceptionalStream<? extends A, E> a, ExceptionalStream<? extends B, E> b, ExceptionalStream<? extends C, E> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" streams until one of them runs out of values.static <A,
B, C, T, E extends Exception>
ExceptionalStream<T,E> zip
(ExceptionalStream<? extends A, E> a, ExceptionalStream<? extends B, E> b, ExceptionalStream<? extends C, E> c, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" streams until one of them runs out of values.static <A,
B, T, E extends Exception>
ExceptionalStream<T,E> zip
(ExceptionalStream<? extends A, E> a, ExceptionalStream<? extends B, E> b, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" streams until one of them runs out of values.static <A,
B, T, E extends Exception>
ExceptionalStream<T,E> zip
(Iterable<? extends A> a, Iterable<? extends B> b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" iterators until all of them runs out of values.static <A,
B, T, E extends Exception>
ExceptionalStream<T,E> zip
(Iterable<? extends A> a, Iterable<? extends B> b, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" arrays until one of them runs out of values.static <A,
B, C, T, E extends Exception>
ExceptionalStream<T,E> zip
(Iterable<? extends A> a, Iterable<? extends B> b, Iterable<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" iterators until all of them runs out of values.static <A,
B, C, T, E extends Exception>
ExceptionalStream<T,E> zip
(Iterable<? extends A> a, Iterable<? extends B> b, Iterable<? extends C> c, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" arrays until one of them runs out of values.static <A,
B, T, E extends Exception>
ExceptionalStream<T,E> zip
(Iterator<? extends A> a, Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" iterators until all of them runs out of values.static <A,
B, T, E extends Exception>
ExceptionalStream<T,E> zip
(Iterator<? extends A> a, Iterator<? extends B> b, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" iterators until one of them runs out of values.static <A,
B, C, T, E extends Exception>
ExceptionalStream<T,E> zip
(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" iterators until all of them runs out of values.static <A,
B, C, T, E extends Exception>
ExceptionalStream<T,E> zip
(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" iterators until one of them runs out of values.<T2,
T3, R> ExceptionalStream<R, E> zipWith
(ExceptionalStream<T2, E> b, ExceptionalStream<T3, E> c, Throwables.TriFunction<? super T, ? super T2, ? super T3, R, ? extends E> zipFunction) <T2,
T3, R> ExceptionalStream<R, E> zipWith
(ExceptionalStream<T2, E> b, ExceptionalStream<T3, E> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, Throwables.TriFunction<? super T, ? super T2, ? super T3, R, ? extends E> zipFunction) <T2,
R> ExceptionalStream<R, E> zipWith
(ExceptionalStream<T2, E> b, Throwables.BiFunction<? super T, ? super T2, R, ? extends E> zipFunction) <T2,
R> ExceptionalStream<R, E> zipWith
(ExceptionalStream<T2, E> b, T valueForNoneA, T2 valueForNoneB, Throwables.BiFunction<? super T, ? super T2, R, ? extends E> zipFunction) <T2,
R> ExceptionalStream<R, E> zipWith
(Collection<T2> b, Throwables.BiFunction<? super T, ? super T2, R, ? extends E> zipFunction) <T2,
T3, R> ExceptionalStream<R, E> zipWith
(Collection<T2> b, Collection<T3> c, Throwables.TriFunction<? super T, ? super T2, ? super T3, R, ? extends E> zipFunction) <T2,
T3, R> ExceptionalStream<R, E> zipWith
(Collection<T2> b, Collection<T3> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, Throwables.TriFunction<? super T, ? super T2, ? super T3, R, ? extends E> zipFunction) <T2,
R> ExceptionalStream<R, E> zipWith
(Collection<T2> b, T valueForNoneA, T2 valueForNoneB, Throwables.BiFunction<? super T, ? super T2, R, ? extends E> zipFunction)
-
Method Details
-
empty
- Type Parameters:
T
-E
-- Returns:
-
just
- Type Parameters:
T
-E
-- Parameters:
e
-- Returns:
-
just
- Type Parameters:
T
-E
-- Parameters:
e
-exceptionType
-- Returns:
-
ofNullable
Returns an emptyStream
if the specifiedt
is null.- Type Parameters:
T
-E
-- Parameters:
e
-- Returns:
-
of
- Type Parameters:
T
-E
-- Parameters:
a
-- Returns:
-
of
- Type Parameters:
T
-E
-- Parameters:
c
-- Returns:
-
of
- Type Parameters:
T
-E
-- Parameters:
iter
-- Returns:
-
of
- Type Parameters:
T
-E
-- Parameters:
iterable
-- Returns:
-
of
- Type Parameters:
K
- the key typeV
- the value typeE
-- Parameters:
m
-- Returns:
-
of
- Type Parameters:
T
-E
-- Parameters:
stream
-- Returns:
-
of
- Type Parameters:
T
-E
-- Parameters:
stream
-- Returns:
-
of
public static <T,E extends Exception> ExceptionalStream<T,E> of(Collection<? extends T> c, Class<E> exceptionType) - Type Parameters:
T
-E
-- Parameters:
c
-exceptionType
-- Returns:
-
of
public static <T,E extends Exception> ExceptionalStream<T,E> of(Iterator<? extends T> iter, Class<E> exceptionType) - Type Parameters:
T
-E
-- Parameters:
iter
-exceptionType
-- Returns:
-
of
public static <T,E extends Exception> ExceptionalStream<T,E> of(Iterable<? extends T> iterable, Class<E> exceptionType) - Type Parameters:
T
-E
-- Parameters:
iterable
-exceptionType
-- Returns:
-
of
public static <K,V, ExceptionalStream<Map.Entry<K,E extends Exception> V>, ofE> (Map<K, V> m, Class<E> exceptionType) - Type Parameters:
K
- the key typeV
- the value typeE
-- Parameters:
m
-exceptionType
-- Returns:
-
of
public static <T,E extends Exception> ExceptionalStream<T,E> of(Stream<? extends T> stream, Class<E> exceptionType) - Type Parameters:
T
-E
-- Parameters:
stream
-exceptionType
-- Returns:
-
of
public static <T,E extends Exception> ExceptionalStream<T,E> of(Stream<? extends T> stream, Class<E> exceptionType) - Type Parameters:
T
-E
-- Parameters:
stream
-exceptionType
-- Returns:
-
of
-
of
-
of
-
of
-
of
- Type Parameters:
E
-- Parameters:
a
-- Returns:
-
of
- Type Parameters:
E
-- Parameters:
a
-- Returns:
-
of
-
of
- Type Parameters:
E
-- Parameters:
a
-- Returns:
-
of
-
of
-
ofKeys
-
ofKeys
public static <K,V, ExceptionalStream<K,E extends Exception> E> ofKeys(Map<K, V> map, Throwables.Predicate<? super V, E> valueFilter) -
ofKeys
public static <K,V, ExceptionalStream<K,E extends Exception> E> ofKeys(Map<K, V> map, Throwables.BiPredicate<? super K, ? super V, E> filter) -
ofValues
-
ofValues
public static <K,V, ExceptionalStream<V,E extends Exception> E> ofValues(Map<K, V> map, Throwables.Predicate<? super K, E> keyFilter) -
ofValues
public static <K,V, ExceptionalStream<V,E extends Exception> E> ofValues(Map<K, V> map, Throwables.BiPredicate<? super K, ? super V, E> filter) -
from
@Beta public static <T,E extends Exception> ExceptionalStream<T,E> from(Throwables.Supplier<? extends Collection<? extends T>, ? extends E> supplier) Lazy evaluation.
This is equal to:ExceptionalStream.just(supplier).flattMap(it -> it.get())
.- Parameters:
supplier
-- Returns:
-
defer
public static <T,E extends Exception> ExceptionalStream<T,E> defer(Throwables.Supplier<? extends ExceptionalStream<? extends T, ? extends E>, ? extends E> supplier) Lazy evaluation.
This is equal to:ExceptionalStream.just(supplier).flatMap(it -> it.get())
.- Parameters:
supplier
-- Returns:
-
iterate
public static <T,E extends Exception> ExceptionalStream<T,E> iterate(Throwables.BooleanSupplier<? extends E> hasNext, Throwables.Supplier<? extends T, E> next) - Type Parameters:
T
-E
-- Parameters:
hasNext
-next
-- Returns:
-
iterate
public static <T,E extends Exception> ExceptionalStream<T,E> iterate(T init, Throwables.BooleanSupplier<? extends E> hasNext, Throwables.UnaryOperator<T, ? extends E> f) - Type Parameters:
T
-E
-- Parameters:
init
-hasNext
-f
-- Returns:
-
iterate
public static <T,E extends Exception> ExceptionalStream<T,E> iterate(T init, Throwables.Predicate<? super T, ? extends E> hasNext, Throwables.UnaryOperator<T, ? extends E> f) - Type Parameters:
T
-E
-- Parameters:
init
-hasNext
-f
-- Returns:
-
iterate
public static <T,E extends Exception> ExceptionalStream<T,E> iterate(T init, Throwables.UnaryOperator<T, ? extends E> f) - Type Parameters:
T
-E
-- Parameters:
init
-f
-- Returns:
-
generate
public static <T,E extends Exception> ExceptionalStream<T,E> generate(Throwables.Supplier<T, E> supplier) -
repeat
-
range
public static <E extends Exception> ExceptionalStream<Integer,E> range(int startInclusive, int endExclusive) -
range
public static <E extends Exception> ExceptionalStream<Integer,E> range(int startInclusive, int endExclusive, int by) -
rangeClosed
public static <E extends Exception> ExceptionalStream<Integer,E> rangeClosed(int startInclusive, int endExclusive) -
rangeClosed
public static <E extends Exception> ExceptionalStream<Integer,E> rangeClosed(int startInclusive, int endExclusive, int by) -
split
public static <E extends Exception> ExceptionalStream<String,E> split(CharSequence str, CharSequence delimiter) -
lines
- Parameters:
file
-- Returns:
-
lines
- Parameters:
file
-charset
-- Returns:
-
lines
- Parameters:
path
-- Returns:
-
lines
- Parameters:
path
-charset
-- Returns:
-
lines
- Parameters:
reader
-- Returns:
-
listFiles
-
listFiles
-
concat
-
concat
@SafeVarargs public static <T,E extends Exception> ExceptionalStream<T,E> concat(Iterable<? extends T>... a) -
concat
@SafeVarargs public static <T,E extends Exception> ExceptionalStream<T,E> concat(Iterator<? extends T>... a) -
concat
@SafeVarargs public static <T,E extends Exception> ExceptionalStream<T,E> concat(ExceptionalStream<? extends T, E>... a) - Type Parameters:
T
-E
-- Parameters:
a
-- Returns:
-
concat
public static <T,E extends Exception> ExceptionalStream<T,E> concat(Collection<? extends ExceptionalStream<? extends T, E>> c) - Type Parameters:
T
-E
-- Parameters:
c
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,T, E extends Exception> E> zip(A[] a, B[] b, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" arrays until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,C, T, E extends Exception> E> zip(A[] a, B[] b, C[] c, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" arrays until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,T, E extends Exception> E> zip(Iterable<? extends A> a, Iterable<? extends B> b, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" arrays until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,C, T, E extends Exception> E> zip(Iterable<? extends A> a, Iterable<? extends B> b, Iterable<? extends C> c, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" arrays until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,T, E extends Exception> E> zip(Iterator<? extends A> a, Iterator<? extends B> b, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" iterators until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,C, T, E extends Exception> E> zip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" iterators until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,T, E extends Exception> E> zip(ExceptionalStream<? extends A, E> a, ExceptionalStream<? extends B, E> b, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" streams until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,C, T, E extends Exception> E> zip(ExceptionalStream<? extends A, E> a, ExceptionalStream<? extends B, E> b, ExceptionalStream<? extends C, E> c, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" streams until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-c
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,T, E extends Exception> E> zip(A[] a, B[] b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-valueForNoneA
- value to fill if "a" runs out of values first.valueForNoneB
- value to fill if "b" runs out of values first.zipFunction
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,C, T, E extends Exception> E> zip(A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-c
-valueForNoneA
- value to fill if "a" runs out of values.valueForNoneB
- value to fill if "b" runs out of values.valueForNoneC
- value to fill if "c" runs out of values.zipFunction
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,T, E extends Exception> E> zip(Iterable<? extends A> a, Iterable<? extends B> b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-valueForNoneA
- value to fill if "a" runs out of values first.valueForNoneB
- value to fill if "b" runs out of values first.zipFunction
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,C, T, E extends Exception> E> zip(Iterable<? extends A> a, Iterable<? extends B> b, Iterable<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-c
-valueForNoneA
- value to fill if "a" runs out of values.valueForNoneB
- value to fill if "b" runs out of values.valueForNoneC
- value to fill if "c" runs out of values.zipFunction
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,T, E extends Exception> E> zip(Iterator<? extends A> a, Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" iterators until all of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-valueForNoneA
- value to fill if "a" runs out of values first.valueForNoneB
- value to fill if "b" runs out of values first.zipFunction
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,C, T, E extends Exception> E> zip(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" iterators until all of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-c
-valueForNoneA
- value to fill if "a" runs out of values.valueForNoneB
- value to fill if "b" runs out of values.valueForNoneC
- value to fill if "c" runs out of values.zipFunction
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,T, E extends Exception> E> zip(ExceptionalStream<? extends A, E> a, ExceptionalStream<? extends B, E> b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, T, ? extends E> zipFunction) Zip together the "a" and "b" streams until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-- Returns:
-
zip
public static <A,B, ExceptionalStream<T,C, T, E extends Exception> E> zip(ExceptionalStream<? extends A, E> a, ExceptionalStream<? extends B, E> b, ExceptionalStream<? extends C, E> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriFunction<? super A, ? super B, ? super C, T, ? extends E> zipFunction) Zip together the "a", "b" and "c" streams until one of them runs out of values. Each triple of values is combined into a single value using the supplied zipFunction function.- Parameters:
a
-b
-c
-- Returns:
-
merge
public static <T,E extends Exception> ExceptionalStream<T,E> merge(T[] a, T[] b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Parameters:
a
-b
-nextSelector
- first parameter is selected ifNth.FIRST
is returned, otherwise the second parameter is selected.- Returns:
-
merge
public static <T,E extends Exception> ExceptionalStream<T,E> merge(T[] a, T[] b, T[] c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Parameters:
a
-b
-c
-nextSelector
- first parameter is selected ifNth.FIRST
is returned, otherwise the second parameter is selected.- Returns:
-
merge
public static <T,E extends Exception> ExceptionalStream<T,E> merge(Iterable<? extends T> a, Iterable<? extends T> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Parameters:
a
-b
-nextSelector
- first parameter is selected ifNth.FIRST
is returned, otherwise the second parameter is selected.- Returns:
-
merge
public static <T,E extends Exception> ExceptionalStream<T,E> merge(Iterable<? extends T> a, Iterable<? extends T> b, Iterable<? extends T> c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Parameters:
a
-b
-c
-nextSelector
- first parameter is selected ifNth.FIRST
is returned, otherwise the second parameter is selected.- Returns:
-
merge
public static <T,E extends Exception> ExceptionalStream<T,E> merge(Iterator<? extends T> a, Iterator<? extends T> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Parameters:
a
-b
-nextSelector
- first parameter is selected ifNth.FIRST
is returned, otherwise the second parameter is selected.- Returns:
-
merge
public static <T,E extends Exception> ExceptionalStream<T,E> merge(Iterator<? extends T> a, Iterator<? extends T> b, Iterator<? extends T> c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Parameters:
a
-b
-c
-nextSelector
- first parameter is selected ifNth.FIRST
is returned, otherwise the second parameter is selected.- Returns:
-
merge
public static <T,E extends Exception> ExceptionalStream<T,E> merge(ExceptionalStream<? extends T, E> a, ExceptionalStream<? extends T, E> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Parameters:
a
-b
-nextSelector
- first parameter is selected ifNth.FIRST
is returned, otherwise the second parameter is selected.- Returns:
-
merge
public static <T,E extends Exception> ExceptionalStream<T,E> merge(ExceptionalStream<? extends T, E> a, ExceptionalStream<? extends T, E> b, ExceptionalStream<? extends T, E> c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) -
filter
@IntermediateOp public ExceptionalStream<T,E> filter(Throwables.Predicate<? super T, ? extends E> predicate) - Parameters:
predicate
-- Returns:
-
filter
@IntermediateOp public ExceptionalStream<T,E> filter(Throwables.Predicate<? super T, ? extends E> predicate, Throwables.Consumer<? super T, ? extends E> actionOnDroppedItem) - Parameters:
predicate
-actionOnDroppedItem
-- Returns:
-
takeWhile
@IntermediateOp public ExceptionalStream<T,E> takeWhile(Throwables.Predicate<? super T, ? extends E> predicate) - Parameters:
predicate
-- Returns:
-
dropWhile
@IntermediateOp public ExceptionalStream<T,E> dropWhile(Throwables.Predicate<? super T, ? extends E> predicate) - Parameters:
predicate
-- Returns:
-
dropWhile
@IntermediateOp public ExceptionalStream<T,E> dropWhile(Throwables.Predicate<? super T, ? extends E> predicate, Throwables.Consumer<? super T, ? extends E> actionOnDroppedItem) - Parameters:
predicate
-actionOnDroppedItem
-- Returns:
-
skipUntil
@Beta @IntermediateOp public ExceptionalStream<T,E> skipUntil(Throwables.Predicate<? super T, ? extends E> predicate) - Parameters:
predicate
-- Returns:
-
distinct
Distinct and filter by occurrences.- Returns:
-
distinct
@IntermediateOp @TerminalOpTriggered public ExceptionalStream<T,E> distinct(Throwables.BinaryOperator<T, ? extends E> mergeFunction) Distinct and filter by occurrences.- Parameters:
mergeFunction
-- Returns:
- See Also:
-
#groupBy(Function, Function, BinaryOperator)
-
distinct
@IntermediateOp @TerminalOpTriggered public ExceptionalStream<T,E> distinct(Throwables.Predicate<? super Long, ? extends E> occurrencesFilter) Distinct and filter by occurrences.- Parameters:
occurrencesFilter
-- Returns:
- See Also:
-
#groupBy(Function, Collector)
-
distinctBy
@IntermediateOp public <K> ExceptionalStream<T,E> distinctBy(Throwables.Function<? super T, K, ? extends E> keyMapper) Distinct by the value mapped fromkeyMapper
.- Parameters:
keyMapper
- don't change value of the input parameter.- Returns:
-
distinctBy
@IntermediateOp @TerminalOpTriggered public <K> ExceptionalStream<T,E> distinctBy(Throwables.Function<? super T, K, ? extends E> keyMapper, Throwables.BinaryOperator<T, ? extends E> mergeFunction) Distinct and filter by occurrences.- Parameters:
keyMapper
-mergeFunction
-- Returns:
- See Also:
-
#groupBy(Function, Function, BinaryOperator)
-
distinctBy
@IntermediateOp @TerminalOpTriggered public <K> ExceptionalStream<T,E> distinctBy(Throwables.Function<? super T, K, ? extends E> keyMapper, Throwables.Predicate<? super Long, ? extends E> occurrencesFilter) Distinct and filter by occurrences.- Parameters:
keyMapper
-occurrencesFilter
-- Returns:
- See Also:
-
#groupBy(Function, Collector)
-
map
@IntermediateOp public <U> ExceptionalStream<U,E> map(Throwables.Function<? super T, ? extends U, ? extends E> mapper) - Type Parameters:
U
-- Parameters:
mapper
-- Returns:
-
mapFirst
@IntermediateOp public ExceptionalStream<T,E> mapFirst(Throwables.Function<? super T, ? extends T, ? extends E> mapperForFirst) -
mapFirstOrElse
@IntermediateOp public <R> ExceptionalStream<R,E> mapFirstOrElse(Throwables.Function<? super T, ? extends R, E> mapperForFirst, Throwables.Function<? super T, ? extends R, E> mapperForElse) -
mapLast
@IntermediateOp public ExceptionalStream<T,E> mapLast(Throwables.Function<? super T, ? extends T, ? extends E> mapperForLast) -
mapLastOrElse
@IntermediateOp public <R> ExceptionalStream<R,E> mapLastOrElse(Throwables.Function<? super T, ? extends R, E> mapperForLast, Throwables.Function<? super T, ? extends R, E> mapperForElse) -
flatMap
@IntermediateOp public <R> ExceptionalStream<R,E> flatMap(Throwables.Function<? super T, ? extends ExceptionalStream<? extends R, ? extends E>, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatmap
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> flatmap(Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flattMap
@IntermediateOp public <R> ExceptionalStream<R,E> flattMap(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatMapp
@IntermediateOp public <R> ExceptionalStream<R,E> flatMapp(Throwables.Function<? super T, R[], ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flattMapIfNotNull
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> flattMapIfNotNull(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flattMapIfNotNull
@Beta @IntermediateOp public <U,R> ExceptionalStream<R,E> flattMapIfNotNull(Throwables.Function<? super T, ? extends Collection<? extends U>, ? extends E> mapper, Throwables.Function<? super U, ? extends Collection<? extends R>, ? extends E> mapper2) - Type Parameters:
U
-R
-- Parameters:
mapper
-mapper2
-- Returns:
-
flatMapToBoolean
@Beta @IntermediateOp public ExceptionalStream<Boolean,E> flatMapToBoolean(Throwables.Function<? super T, boolean[], ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatMapToChar
@Beta @IntermediateOp public ExceptionalStream<Character,E> flatMapToChar(Throwables.Function<? super T, char[], ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatMapToByte
@Beta @IntermediateOp public ExceptionalStream<Byte,E> flatMapToByte(Throwables.Function<? super T, byte[], ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatMapToShort
@Beta @IntermediateOp public ExceptionalStream<Short,E> flatMapToShort(Throwables.Function<? super T, short[], ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatMapToInteger
@Beta @IntermediateOp public ExceptionalStream<Integer,E> flatMapToInteger(Throwables.Function<? super T, int[], ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatMapToLong
@Beta @IntermediateOp public ExceptionalStream<Long,E> flatMapToLong(Throwables.Function<? super T, long[], ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatMapToFloat
@Beta @IntermediateOp public ExceptionalStream<Float,E> flatMapToFloat(Throwables.Function<? super T, float[], ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatMapToDouble
@Beta @IntermediateOp public ExceptionalStream<Double,E> flatMapToDouble(Throwables.Function<? super T, double[], ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
mapPartial
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> mapPartial(Throwables.Function<? super T, u.Optional<? extends R>, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamex- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
mapPartialToInt
@Beta @IntermediateOp public ExceptionalStream<Integer,E> mapPartialToInt(Throwables.Function<? super T, u.OptionalInt, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamex- Parameters:
mapper
-- Returns:
-
mapPartialToLong
@Beta @IntermediateOp public ExceptionalStream<Long,E> mapPartialToLong(Throwables.Function<? super T, u.OptionalLong, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamex- Parameters:
mapper
-- Returns:
-
mapPartialToDouble
@Beta @IntermediateOp public ExceptionalStream<Double,E> mapPartialToDouble(Throwables.Function<? super T, u.OptionalDouble, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamex- Parameters:
mapper
-- Returns:
-
mapPartialJdk
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> mapPartialJdk(Throwables.Function<? super T, Optional<? extends R>, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamex- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
mapPartialToIntJdk
@Beta @IntermediateOp public ExceptionalStream<Integer,E> mapPartialToIntJdk(Throwables.Function<? super T, OptionalInt, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamex- Parameters:
mapper
-- Returns:
-
mapPartialToLongJdk
@Beta @IntermediateOp public ExceptionalStream<Long,E> mapPartialToLongJdk(Throwables.Function<? super T, OptionalLong, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamex- Parameters:
mapper
-- Returns:
-
mapPartialToDoubleJdk
@Beta @IntermediateOp public ExceptionalStream<Double,E> mapPartialToDoubleJdk(Throwables.Function<? super T, OptionalDouble, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamex- Parameters:
mapper
-- Returns:
-
mapMulti
public <R> ExceptionalStream<R,E> mapMulti(Throwables.BiConsumer<? super T, ? super Consumer<R>, ? extends E> mapper) -
slidingMap
@IntermediateOp public <R> ExceptionalStream<R,E> slidingMap(Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
slidingMap
@IntermediateOp public <R> ExceptionalStream<R,E> slidingMap(Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper, int increment) - Type Parameters:
R
-- Parameters:
mapper
-increment
-- Returns:
-
slidingMap
@IntermediateOp public <R> ExceptionalStream<R,E> slidingMap(Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper, int increment, boolean ignoreNotPaired) - Type Parameters:
R
-- Parameters:
mapper
-increment
-ignoreNotPaired
-- Returns:
-
slidingMap
@IntermediateOp public <R> ExceptionalStream<R,E> slidingMap(Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
slidingMap
@IntermediateOp public <R> ExceptionalStream<R,E> slidingMap(Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper, int increment) - Type Parameters:
R
-- Parameters:
mapper
-increment
-- Returns:
-
slidingMap
@IntermediateOp public <R> ExceptionalStream<R,E> slidingMap(Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper, int increment, boolean ignoreNotPaired) - Type Parameters:
R
-- Parameters:
mapper
-increment
-ignoreNotPaired
-- Returns:
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K> ExceptionalStream<Map.Entry<K,List<T>>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper) - Type Parameters:
K
- the key type- Parameters:
keyMapper
-- Returns:
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K> ExceptionalStream<Map.Entry<K,List<T>>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Supplier<? extends Map<K, List<T>>> mapFactory) - Type Parameters:
K
- the key type- Parameters:
keyMapper
-mapFactory
-- Returns:
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K,V> ExceptionalStream<Map.Entry<K,List<V>>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper) - Type Parameters:
K
- the key typeV
- the value type- Parameters:
keyMapper
-valueMapper
-- Returns:
- See Also:
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K,V> ExceptionalStream<Map.Entry<K,List<V>>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Supplier<? extends Map<K, List<V>>> mapFactory) - Type Parameters:
K
- the key typeV
- the value type- Parameters:
keyMapper
-valueMapper
-mapFactory
-- Returns:
- See Also:
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K,V> ExceptionalStream<Map.Entry<K,V>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Throwables.BinaryOperator<V, ? extends E> mergeFunction) - Type Parameters:
K
- the key typeV
- the value type- Parameters:
keyMapper
-valueMapper
-mergeFunction
-- Returns:
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K,V> ExceptionalStream<Map.Entry<K,V>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Throwables.BinaryOperator<V, ? extends E> mergeFunction, Supplier<? extends Map<K, V>> mapFactory) - Type Parameters:
K
- the key typeV
- the value type- Parameters:
keyMapper
-valueMapper
-mergeFunction
-mapFactory
-- Returns:
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K,A, ExceptionalStream<Map.Entry<K,D> D>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Collector<? super T, A, D> downstream) - Type Parameters:
K
- the key typeA
-D
-- Parameters:
keyMapper
-downstream
-- Returns:
- Throws:
E
- the e
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K,A, ExceptionalStream<Map.Entry<K,D> D>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Collector<? super T, A, D> downstream, Supplier<? extends Map<K, D>> mapFactory) - Type Parameters:
K
- the key typeA
-D
-- Parameters:
keyMapper
-downstream
-mapFactory
-- Returns:
- Throws:
E
- the e
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K,V, ExceptionalStream<Map.Entry<K,A, D> D>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Collector<? super V, A, D> downstream) - Type Parameters:
K
- the key typeV
- the value typeA
-D
-- Parameters:
keyMapper
-valueMapper
-downstream
-- Returns:
- Throws:
E
- the e
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K,V, ExceptionalStream<Map.Entry<K,A, D> D>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Collector<? super V, A, D> downstream, Supplier<? extends Map<K, D>> mapFactory) - Type Parameters:
K
- the key typeV
- the value typeA
-D
-- Parameters:
keyMapper
-valueMapper
-downstream
-mapFactory
-- Returns:
- Throws:
E
- the e
-
partitionBy
@IntermediateOp @TerminalOpTriggered public ExceptionalStream<Map.Entry<Boolean,List<T>>, partitionByE> (Throwables.Predicate<? super T, E> predicate) - Parameters:
predicate
-- Returns:
- See Also:
-
partitionBy
@IntermediateOp @TerminalOpTriggered public <A,D> ExceptionalStream<Map.Entry<Boolean,D>, partitionByE> (Throwables.Predicate<? super T, E> predicate, Collector<? super T, A, D> downstream) - Parameters:
predicate
-downstream
-- Returns:
- See Also:
-
countBy
@IntermediateOp @TerminalOpTriggered public <K> ExceptionalStream<Map.Entry<K,Integer>, countByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper) - Type Parameters:
K
-- Parameters:
keyMapper
-- Returns:
-
collapse
@IntermediateOp public ExceptionalStream<Stream<T>,E> collapse(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible) - Parameters:
collapsible
- test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.- Returns:
-
collapse
@IntermediateOp public <C extends Collection<T>> ExceptionalStream<C,E> collapse(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, Supplier<? extends C> supplier) - Type Parameters:
C
-- Parameters:
collapsible
- test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.supplier
-- Returns:
-
collapse
@IntermediateOp public ExceptionalStream<T,E> collapse(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, Throwables.BiFunction<? super T, ? super T, T, ? extends E> mergeFunction) Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.Example:
ExceptionalStream.of(new Integer[0]).collapse((p, c) -> p < c, (r, c) -> r + c) => [] ExceptionalStream.of(1).collapse((p, c) -> p < c, (r, c) -> r + c) => [1] ExceptionalStream.of(1, 2).collapse((p, c) -> p < c, (r, c) -> r + c) => [3] ExceptionalStream.of(1, 2, 3).collapse((p, c) -> p < c, (r, c) -> r + c) => [6] ExceptionalStream.of(1, 2, 3, 3, 2, 1).collapse((p, c) -> p < c, (r, c) -> r + c) => [6, 3, 2, 1]
This method only runs sequentially, even in parallel stream.- Parameters:
collapsible
- test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.mergeFunction
-- Returns:
-
collapse
@IntermediateOp public <U> ExceptionalStream<U,E> collapse(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, U init, Throwables.BiFunction<U, ? super T, U, ? extends E> op) - Type Parameters:
U
-- Parameters:
collapsible
- test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.init
- is used byop
to generate the first result value in the series.op
-- Returns:
-
collapse
@IntermediateOp public <R> ExceptionalStream<R,E> collapse(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, Throwables.Supplier<R, E> supplier, Throwables.BiConsumer<? super R, ? super T, ? extends E> accumulator) - Type Parameters:
R
-- Parameters:
collapsible
- test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.supplier
-accumulator
-- Returns:
-
collapse
@IntermediateOp public <R,A> ExceptionalStream<R,E> collapse(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, Collector<? super T, A, R> collector) - Type Parameters:
R
-A
-- Parameters:
collapsible
- test the current element with its previous element. The first parameter is the previous element of current element, the second parameter is the current element.collector
-- Returns:
-
collapse
@IntermediateOp public ExceptionalStream<Stream<T>,E> collapse(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible) - Parameters:
collapsible
- test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.- Returns:
-
collapse
@IntermediateOp public <C extends Collection<T>> ExceptionalStream<C,E> collapse(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, Supplier<? extends C> supplier) - Type Parameters:
C
-- Parameters:
collapsible
- test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.supplier
-- Returns:
-
collapse
@IntermediateOp public ExceptionalStream<T,E> collapse(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, Throwables.BiFunction<? super T, ? super T, T, ? extends E> mergeFunction) Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.Example:
Stream.of(new Integer[0]).collapse((f, p, c) -> f < c, (r, c) -> r + c) => [] Stream.of(1).collapse((f, p, c) -> f < c, (r, c) -> r + c) => [1] Stream.of(1, 2).collapse((f, p, c) -> f < c, (r, c) -> r + c) => [3] Stream.of(1, 2, 3).collapse((f, p, c) -> f < c, (r, c) -> r + c) => [6] Stream.of(1, 2, 3, 3, 2, 1).collapse((f, p, c) -> f < c, (r, c) -> r + c) => [11, 1]
This method only runs sequentially, even in parallel stream.- Parameters:
collapsible
- test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.mergeFunction
-- Returns:
-
collapse
@IntermediateOp public <U> ExceptionalStream<U,E> collapse(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, U init, Throwables.BiFunction<U, ? super T, U, ? extends E> op) - Type Parameters:
U
-- Parameters:
collapsible
- test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.init
- is used byop
to generate the first result value in the series.op
-- Returns:
-
collapse
@IntermediateOp public <R> ExceptionalStream<R,E> collapse(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, Throwables.Supplier<R, E> supplier, Throwables.BiConsumer<? super R, ? super T, ? extends E> accumulator) - Type Parameters:
R
-- Parameters:
collapsible
- test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.supplier
-accumulator
-- Returns:
-
collapse
@IntermediateOp public <R,A> ExceptionalStream<R,E> collapse(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, Collector<? super T, A, R> collector) Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.Example:
ExceptionalStream.of(new Integer[0]).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [] ExceptionalStream.of(1).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [1] ExceptionalStream.of(1, 2).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [3] ExceptionalStream.of(1, 2, 3).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [6] ExceptionalStream.of(1, 2, 3, 3, 2, 1).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [11, 1]
- Type Parameters:
R
-A
-- Parameters:
collapsible
- test the current element with the first element and previous element in the series. The first parameter is the first element of this series, the second parameter is the previous element and the third parameter is the current element.collector
-- Returns:
-
scan
@IntermediateOp public ExceptionalStream<T,E> scan(Throwables.BiFunction<? super T, ? super T, T, ? extends E> accumulator) - Parameters:
accumulator
-- Returns:
-
scan
@IntermediateOp public <U> ExceptionalStream<U,E> scan(U init, Throwables.BiFunction<U, ? super T, U, ? extends E> accumulator) - Type Parameters:
U
-- Parameters:
init
-accumulator
-- Returns:
-
scan
@IntermediateOp public <U> ExceptionalStream<U,E> scan(U init, Throwables.BiFunction<U, ? super T, U, ? extends E> accumulator, boolean initIncluded) - Type Parameters:
U
-- Parameters:
init
-accumulator
-initIncluded
-- Returns:
-
intersection
- Parameters:
c
-- Returns:
- See Also:
-
intersection
public <U> ExceptionalStream<T,E> intersection(Throwables.Function<? super T, ? extends U, E> mapper, Collection<U> c) - Parameters:
mapper
-c
-- Returns:
- See Also:
-
difference
- Parameters:
c
-- Returns:
- See Also:
-
difference
public <U> ExceptionalStream<T,E> difference(Function<? super T, ? extends U> mapper, Collection<U> c) - Parameters:
mapper
-c
-- Returns:
- See Also:
-
symmetricDifference
- Parameters:
c
-- Returns:
- See Also:
-
defaultIfEmpty
- Parameters:
defaultValue
-- Returns:
- See Also:
-
defaultIfEmpty
@IntermediateOp public final ExceptionalStream<T,E> defaultIfEmpty(Throwables.Supplier<? extends ExceptionalStream<T, E>, ? extends E> supplier) - Parameters:
supplier
-- Returns:
- See Also:
-
prepend
-
prepend
-
prepend
- Parameters:
s
-- Returns:
-
append
-
append
-
append
- Parameters:
s
-- Returns:
-
appendIfEmpty
-
appendIfEmpty
-
appendIfEmpty
@IntermediateOp public ExceptionalStream<T,E> appendIfEmpty(Throwables.Supplier<? extends ExceptionalStream<T, E>, ? extends E> supplier) Append if empty.- Parameters:
supplier
-- Returns:
- Throws:
E
- the e
-
throwIfEmpty
-
applyIfNotEmpty
@TerminalOp public <R,E2 extends Exception> u.Optional<R> applyIfNotEmpty(Throwables.Function<? super ExceptionalStream<T, E>, throws E, E2R, E2> func) -
acceptIfNotEmpty
@TerminalOp public <E2 extends Exception> If.OrElse acceptIfNotEmpty(Throwables.Consumer<? super ExceptionalStream<T, E>, throws E, E2E2> action) -
onEach
@IntermediateOp public ExceptionalStream<T,E> onEach(Throwables.Consumer<? super T, ? extends E> action) - Parameters:
action
-- Returns:
-
peek
@IntermediateOp public ExceptionalStream<T,E> peek(Throwables.Consumer<? super T, ? extends E> action) - Parameters:
action
-- Returns:
-
peekFirst
@IntermediateOp public ExceptionalStream<T,E> peekFirst(Throwables.Consumer<? super T, ? extends E> action) -
peekLast
@IntermediateOp public ExceptionalStream<T,E> peekLast(Throwables.Consumer<? super T, ? extends E> action) -
peekIf
@IntermediateOp public ExceptionalStream<T,E> peekIf(Throwables.Predicate<? super T, E> predicate, Throwables.Consumer<? super T, E> action) - Parameters:
predicate
-action
-- Returns:
-
peekIf
@Beta @IntermediateOp public ExceptionalStream<T,E> peekIf(Throwables.BiPredicate<? super T, ? super Long, E> predicate, Consumer<? super T> action) - Parameters:
predicate
- The first parameter is the element. The second parameter is the count of iterated elements, starts with 1.action
-- Returns:
-
split
- Parameters:
chunkSize
-- Returns:
-
splitToList
Returns ExceptionalStream ofList<T>
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).- Parameters:
chunkSize
- the desired size of each sub sequence (the last may be smaller).- Returns:
-
splitToSet
Returns ExceptionalStream ofSet<T>
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).- Parameters:
chunkSize
- the desired size of each sub sequence (the last may be smaller).- Returns:
-
split
@IntermediateOp public <C extends Collection<T>> ExceptionalStream<C,E> split(int chunkSize, IntFunction<? extends C> collectionSupplier) Returns ExceptionalStream ofC
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).- Type Parameters:
C
-- Parameters:
chunkSize
- the desired size of each sub sequence (the last may be smaller).collectionSupplier
-- Returns:
-
split
@IntermediateOp public <R,A> ExceptionalStream<R,E> split(int chunkSize, Collector<? super T, A, R> collector) - Type Parameters:
R
-A
-- Parameters:
chunkSize
- the desired size of each sub sequence (the last may be smaller).collector
-- Returns:
-
splitAt
-
splitAt
@IntermediateOp public ExceptionalStream<ExceptionalStream<T,E>, splitAtE> (Throwables.Predicate<? super T, ? extends E> where) -
sliding
- Parameters:
windowSize
-increment
-- Returns:
-
slidingToList
Sliding to list.- Parameters:
windowSize
-increment
-- Returns:
-
slidingToSet
Sliding to set.- Parameters:
windowSize
-increment
-- Returns:
-
sliding
@IntermediateOp public <C extends Collection<T>> ExceptionalStream<C,E> sliding(int windowSize, int increment, IntFunction<? extends C> collectionSupplier) - Type Parameters:
C
-- Parameters:
windowSize
-increment
-collectionSupplier
-- Returns:
-
sliding
@IntermediateOp public <A,R> ExceptionalStream<R,E> sliding(int windowSize, int increment, Collector<? super T, A, R> collector) - Type Parameters:
A
-R
-- Parameters:
windowSize
-increment
-collector
-- Returns:
-
skip
- Parameters:
n
-- Returns:
-
skipNull
-
limit
- Parameters:
maxSize
-- Returns:
-
top
-
top
-
last
A queue with size up ton
will be maintained to filter out the lastn
elements. It may causeout of memory error
ifn
is big enough.
All the elements will be loaded to get the lastn
elements and the Stream will be closed after that, if a terminal operation is triggered.- Parameters:
n
-- Returns:
- See Also:
-
skipLast
-
reversed
-
rotated
-
shuffled
-
shuffled
-
sorted
-
sorted
@IntermediateOp @TerminalOpTriggered public ExceptionalStream<T,E> sorted(Comparator<? super T> comparator) - Parameters:
comparator
-- Returns:
-
sortedBy
@IntermediateOp @TerminalOpTriggered public ExceptionalStream<T,E> sortedBy(Function<? super T, ? extends Comparable> keyMapper) - Parameters:
keyMapper
-- Returns:
-
reverseSorted
-
reverseSorted
@IntermediateOp @TerminalOpTriggered public ExceptionalStream<T,E> reverseSorted(Comparator<? super T> comparator) -
cycled
-
cycled
-
rateLimited
- Parameters:
rateLimiter
-- Returns:
-
rateLimited
- Parameters:
permitsPerSecond
-- Returns:
- See Also:
-
intersperse
-
step
-
indexed
-
mergeWith
@IntermediateOp public ExceptionalStream<T,E> mergeWith(Collection<? extends T> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Parameters:
b
-nextSelector
- first parameter is selected ifNth.FIRST
is returned, otherwise the second parameter is selected.- Returns:
-
mergeWith
@IntermediateOp public ExceptionalStream<T,E> mergeWith(ExceptionalStream<? extends T, E> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Parameters:
b
-nextSelector
- first parameter is selected ifNth.FIRST
is returned, otherwise the second parameter is selected.- Returns:
-
zipWith
@IntermediateOp public <T2,R> ExceptionalStream<R,E> zipWith(Collection<T2> b, Throwables.BiFunction<? super T, ? super T2, R, ? extends E> zipFunction) - Type Parameters:
T2
-R
-- Parameters:
b
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,R> ExceptionalStream<R,E> zipWith(Collection<T2> b, T valueForNoneA, T2 valueForNoneB, Throwables.BiFunction<? super T, ? super T2, R, ? extends E> zipFunction) - Type Parameters:
T2
-R
-- Parameters:
b
-valueForNoneA
-valueForNoneB
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,T3, ExceptionalStream<R,R> E> zipWith(Collection<T2> b, Collection<T3> c, Throwables.TriFunction<? super T, ? super T2, ? super T3, R, ? extends E> zipFunction) - Type Parameters:
T2
-T3
-R
-- Parameters:
b
-c
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,T3, ExceptionalStream<R,R> E> zipWith(Collection<T2> b, Collection<T3> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, Throwables.TriFunction<? super T, ? super T2, ? super T3, R, ? extends E> zipFunction) - Type Parameters:
T2
-T3
-R
-- Parameters:
b
-c
-valueForNoneA
-valueForNoneB
-valueForNoneC
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,R> ExceptionalStream<R,E> zipWith(ExceptionalStream<T2, E> b, Throwables.BiFunction<? super T, ? super T2, R, ? extends E> zipFunction) - Type Parameters:
T2
-R
-- Parameters:
b
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,R> ExceptionalStream<R,E> zipWith(ExceptionalStream<T2, E> b, T valueForNoneA, T2 valueForNoneB, Throwables.BiFunction<? super T, ? super T2, R, ? extends E> zipFunction) - Type Parameters:
T2
-R
-- Parameters:
b
-valueForNoneA
-valueForNoneB
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,T3, ExceptionalStream<R,R> E> zipWith(ExceptionalStream<T2, E> b, ExceptionalStream<T3, E> c, Throwables.TriFunction<? super T, ? super T2, ? super T3, R, ? extends E> zipFunction) - Type Parameters:
T2
-T3
-R
-- Parameters:
b
-c
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,T3, ExceptionalStream<R,R> E> zipWith(ExceptionalStream<T2, E> b, ExceptionalStream<T3, E> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, Throwables.TriFunction<? super T, ? super T2, ? super T3, R, ? extends E> zipFunction) - Type Parameters:
T2
-T3
-R
-- Parameters:
b
-c
-valueForNoneA
-valueForNoneB
-valueForNoneC
-zipFunction
-- Returns:
-
onErrorContinue
@Beta @IntermediateOp public ExceptionalStream<T,E> onErrorContinue(Throwables.Consumer<? super Throwable, ? extends E> errorConsumer) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.- Parameters:
errorConsumer
-- Returns:
-
onErrorContinue
@Beta @IntermediateOp public ExceptionalStream<T,E> onErrorContinue(Class<? extends Throwable> type, Throwables.Consumer<? super Throwable, ? extends E> errorConsumer) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.- Parameters:
type
-errorConsumer
-- Returns:
-
onErrorContinue
@Beta @IntermediateOp public ExceptionalStream<T,E> onErrorContinue(Throwables.Predicate<? super Throwable, ? extends E> errorPredicate, Throwables.Consumer<? super Throwable, ? extends E> errorConsumer) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.- Parameters:
errorPredicate
-errorConsumer
-- Returns:
-
onErrorContinue
@Beta @IntermediateOp public ExceptionalStream<T,E> onErrorContinue(Throwables.Predicate<? super Throwable, ? extends E> errorPredicate, Throwables.Consumer<? super Throwable, ? extends E> errorConsumer, int maxErrorCountToStop) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.- Parameters:
errorPredicate
-errorConsumer
-maxErrorCountToStop
-- Returns:
-
onErrorReturn
This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.- Parameters:
fallbackValue
-- Returns:
-
onErrorReturn
@Beta @IntermediateOp public ExceptionalStream<T,E> onErrorReturn(Class<? extends Throwable> type, T fallbackValue) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.- Parameters:
type
-fallbackValue
-- Returns:
-
onErrorReturn
@Beta @IntermediateOp public ExceptionalStream<T,E> onErrorReturn(Throwables.Predicate<? super Throwable, ? extends E> predicate, T fallbackValue) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.- Parameters:
predicate
-fallbackValue
-- Returns:
-
onErrorReturn
@Beta @IntermediateOp public ExceptionalStream<T,E> onErrorReturn(Throwables.Predicate<? super Throwable, ? extends E> predicate, Throwables.Supplier<? extends T, ? extends E> supplierForFallbackValue) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.- Parameters:
predicate
-supplierForFallbackValue
-- Returns:
-
onErrorReturn
@Beta @IntermediateOp public ExceptionalStream<T,E> onErrorReturn(Throwables.Predicate<? super Throwable, ? extends E> predicate, Throwables.Function<? super Throwable, ? extends T, ? extends E> mapperForFallbackValue, int maxErrorCountToStop) This method should be only applied sequentialStream
and whose up-streams are sequentialStreams
as well. Because error happening in the operations executed by parallel stream will stop iteration on that , so the down-streams won't be able to continue.- Parameters:
predicate
-mapperForFallbackValue
-maxErrorCountToStop
-- Returns:
-
onErrorStop
-
forEach
@TerminalOp public <E2 extends Exception> void forEach(Throwables.Consumer<? super T, E2> action) throws E, E2- Type Parameters:
E2
-- Parameters:
action
-- Throws:
E
- the eE2
- the e2
-
forEachIndexed
@TerminalOp public <E2 extends Exception> void forEachIndexed(Throwables.IndexedConsumer<? super T, E2> action) throws E, E2- Type Parameters:
E2
-- Parameters:
action
-- Throws:
E
- the eE2
- the e2
-
forEachUntil
@Beta @TerminalOp public <E2 extends Exception> void forEachUntil(Throwables.BiConsumer<? super T, MutableBoolean, throws E, E2E2> action) - Type Parameters:
E2
-- Parameters:
action
- the second parameter is a flag to break the for-each loop. Set it totrue
to break the loop if you don't want to continue theaction
. Iteration on this stream will also be stopped when this flag is set totrue
.- Throws:
E
E2
-
forEachUntil
@Beta @TerminalOp public <E2 extends Exception> void forEachUntil(MutableBoolean flagToBreak, Throwables.Consumer<? super T, E2> action) throws E, E2- Type Parameters:
E2
-- Parameters:
flagToBreak
- a flag to break the for-each loop. Set it totrue
to break the loop if you don't want to continue theaction
. Iteration on this stream will also be stopped when this flag is set totrue
.action
-- Throws:
E
E2
- See Also:
-
forEach
@TerminalOp public <E2 extends Exception,E3 extends Exception> void forEach(Throwables.Consumer<? super T, E2> action, Throwables.Runnable<E3> onComplete) throws E, E2, E3- Type Parameters:
E2
-E3
-- Parameters:
action
-onComplete
-- Throws:
E
- the eE2
- the e2E3
- the e3
-
forEach
@TerminalOp public <U,E2 extends Exception, void forEachE3 extends Exception> (Throwables.Function<? super T, ? extends Collection<? extends U>, throws E, E2, E3E2> flatMapper, Throwables.BiConsumer<? super T, ? super U, E3> action) - Type Parameters:
U
-E2
-E3
-- Parameters:
flatMapper
-action
-- Throws:
E
- the eE2
- the e2E3
- the e3
-
forEach
@TerminalOp public <T2,T3, void forEachE2 extends Exception, E3 extends Exception, E4 extends Exception> (Throwables.Function<? super T, ? extends Collection<T2>, throws E, E2, E3, E4E2> flatMapper, Throwables.Function<? super T2, ? extends Collection<T3>, E3> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E4> action) - Type Parameters:
T2
-T3
-E2
-E3
-E4
-- Parameters:
flatMapper
-flatMapper2
-action
-- Throws:
E
- the eE2
- the e2E3
- the e3E4
- the e4
-
forEachPair
@TerminalOp public <E2 extends Exception> void forEachPair(Throwables.BiConsumer<? super T, ? super T, throws E, E2E2> action) For each pair.- Type Parameters:
E2
-- Parameters:
action
-- Throws:
E
- the eE2
- the e2
-
forEachPair
@TerminalOp public <E2 extends Exception> void forEachPair(Throwables.BiConsumer<? super T, ? super T, throws E, E2E2> action, int increment) For each pair.- Type Parameters:
E2
-- Parameters:
action
-increment
-- Throws:
E
- the eE2
- the e2
-
forEachTriple
@TerminalOp public <E2 extends Exception> void forEachTriple(Throwables.TriConsumer<? super T, ? super T, throws E, E2? super T, E2> action) For each triple.- Type Parameters:
E2
-- Parameters:
action
-- Throws:
E
- the eE2
- the e2
-
forEachTriple
@TerminalOp public <E2 extends Exception> void forEachTriple(Throwables.TriConsumer<? super T, ? super T, throws E, E2? super T, E2> action, int increment) For each triple.- Type Parameters:
E2
-- Parameters:
action
-increment
-- Throws:
E
- the eE2
- the e2
-
forEachInParallel
@Beta @TerminalOp public <E2 extends Exception> void forEachInParallel(Throwables.Consumer<? super T, E2> action, int threadNum) throws E, E2- Type Parameters:
E2
-- Parameters:
action
-- Throws:
E
- the eE2
- the e2
-
forEachInParallel
@Beta @TerminalOp public <E2 extends Exception> void forEachInParallel(Throwables.Consumer<? super T, E2> action, int threadNum, Executor executor) throws E, E2- Type Parameters:
E2
-- Parameters:
action
-- Throws:
E
- the eE2
- the e2
-
min
- Parameters:
comparator
-- Returns:
- Throws:
E
- the e
-
minBy
- Parameters:
keyMapper
-- Returns:
- Throws:
E
- the e
-
max
- Parameters:
comparator
-- Returns:
- Throws:
E
- the e
-
maxBy
- Parameters:
keyMapper
-- Returns:
- Throws:
E
- the e
-
anyMatch
@TerminalOp public <E2 extends Exception> boolean anyMatch(Throwables.Predicate<? super T, E2> predicate) throws E, E2- Type Parameters:
E2
-- Parameters:
predicate
-- Returns:
- Throws:
E
E2
-
allMatch
@TerminalOp public <E2 extends Exception> boolean allMatch(Throwables.Predicate<? super T, E2> predicate) throws E, E2- Type Parameters:
E2
-- Parameters:
predicate
-- Returns:
- Throws:
E
E2
-
noneMatch
@TerminalOp public <E2 extends Exception> boolean noneMatch(Throwables.Predicate<? super T, E2> predicate) throws E, E2- Type Parameters:
E2
-- Parameters:
predicate
-- Returns:
- Throws:
E
E2
-
nMatch
@TerminalOp public <E2 extends Exception> boolean nMatch(long atLeast, long atMost, Throwables.Predicate<? super T, E2> predicate) throws E, E2- Type Parameters:
E2
-- Parameters:
atLeast
-atMost
-predicate
-- Returns:
- Throws:
E
E2
-
findFirst
@TerminalOp public <E2 extends Exception> u.Optional<T> findFirst(Throwables.Predicate<? super T, E2> predicate) throws E, E2- Type Parameters:
E2
-- Parameters:
predicate
-- Returns:
- Throws:
E
E2
-
findFirstOrAny
@TerminalOp public <E2 extends Exception> u.Optional<T> findFirstOrAny(Throwables.Predicate<? super T, E2> predicateForFirst) throws E, E2Returns the first element matched bypredicateForFirst
if found or the first element if this stream is not empty Otherwise an emptyOptional<T>
will be returned.- Type Parameters:
E2
-- Parameters:
predicateForFirst
-- Returns:
- Throws:
E
E2
-
findFirstOrAny
@TerminalOp public <E2 extends Exception,E3 extends Exception> u.Optional<T> findFirstOrAny(Throwables.Predicate<? super T, E2> predicateForFirst, Throwables.Predicate<? super T, throws E, E2, E3E3> predicateForAny) Returns the first element matched bypredicateForFirst
if found or the first element matched bypredicateForAny
. Otherwise an emptyOptional<T>
will be returned.- Type Parameters:
E2
-E3
-- Parameters:
predicateForFirst
-predicateForAny
-- Returns:
- Throws:
E
E2
E3
-
findFirstOrLast
@TerminalOp public <E2 extends Exception> u.Optional<T> findFirstOrLast(Throwables.Predicate<? super T, E2> predicateForFirst) throws E, E2Returns the first element matched bypredicateForFirst
if found or the last element if this stream is not empty Otherwise an emptyOptional<T>
will be returned.- Type Parameters:
E2
-- Parameters:
predicateForFirst
-- Returns:
- Throws:
E
E2
-
findLast
@TerminalOp public <E2 extends Exception> u.Optional<T> findLast(Throwables.Predicate<? super T, E2> predicate) throws E, E2Consider using:stream.reversed().findFirst(predicate)
for better performance if possible.- Type Parameters:
E2
-- Parameters:
predicate
-- Returns:
- Throws:
E
E2
-
findAny
@TerminalOp public <E2 extends Exception> u.Optional<T> findAny(Throwables.Predicate<? super T, E2> predicate) throws E, E2Same asfindFirst(Throwables.Predicate)
.- Type Parameters:
E2
-- Parameters:
predicate
-- Returns:
- Throws:
E
E2
- See Also:
-
containsAll
-
containsAll
-
containsAny
-
containsAny
-
hasDuplicates
-
kthLargest
-
percentiles
@TerminalOp public u.Optional<Map<Percentage,T>> percentiles(Comparator<? super T> comparator) throws E -
first
- Returns:
- Throws:
E
- the e
-
last
- Returns:
- Throws:
E
- the e
-
elementAt
- Parameters:
position
- in current stream(not upstream or origin source). It starts from 0.- Returns:
- Throws:
E
- the e
-
onlyOne
- Returns:
- Throws:
DuplicatedResultException
- if there are more than one elements.E
- the e
-
count
- Returns:
- Throws:
E
- the e
-
toArray
- Returns:
- Throws:
E
- the e
-
toArray
- Type Parameters:
A
-- Parameters:
generator
-- Returns:
- Throws:
E
- the e
-
toList
- Returns:
- Throws:
E
- the e
-
toSet
- Returns:
- Throws:
E
- the e
-
toImmutableList
- Returns:
- Throws:
E
- the e
-
toImmutableSet
- Returns:
- Throws:
E
- the e
-
toCollection
@TerminalOp public <C extends Collection<T>> C toCollection(Supplier<? extends C> supplier) throws E - Type Parameters:
C
-- Parameters:
supplier
-- Returns:
- Throws:
E
- the e
-
toListAndThen
@TerminalOp public <R,E2 extends Exception> R toListAndThen(Throwables.Function<? super List<T>, R, throws E, E2E2> func) -
toSetAndThen
@TerminalOp public <R,E2 extends Exception> R toSetAndThen(Throwables.Function<? super Set<T>, R, throws E, E2E2> func) -
toCollectionAndThen
@TerminalOp public <R,CC extends Collection<T>, R toCollectionAndThenE2 extends Exception> (Supplier<? extends CC> supplier, Throwables.Function<? super CC, R, throws E, E2E2> func) -
toImmutableMap
@TerminalOp public <K,V, ImmutableMap<K,E2 extends Exception, E3 extends Exception> V> toImmutableMap(Throwables.Function<? super T, ? extends K, throws E, E2, E3, IllegalStateExceptionE2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper) - Type Parameters:
K
- the key typeV
- the value type- Parameters:
keyMapper
-valueMapper
-- Returns:
- Throws:
E
- the eIllegalStateException
- if there are duplicated keys.E2 extends Exception
E3 extends Exception
-
toImmutableMap
@TerminalOp public <K,V, ImmutableMap<K,E2 extends Exception, E3 extends Exception, E4 extends Exception> V> toImmutableMap(Throwables.Function<? super T, ? extends K, throws E, E2, E3, E4E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Throwables.BinaryOperator<V, E4> mergeFunction) -
toMap
@TerminalOp public <K,V, Map<K,E2 extends Exception, E3 extends Exception> V> toMap(Throwables.Function<? super T, ? extends K, throws E, E2, E3, IllegalStateExceptionE2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper) - Type Parameters:
K
- the key typeV
- the value type- Parameters:
keyMapper
-valueMapper
-- Returns:
- Throws:
E
- the eIllegalStateException
- if there are duplicated keys.E2 extends Exception
E3 extends Exception
-
toMap
@TerminalOp public <K,V, M toMapM extends Map<K, V>, E2 extends Exception, E3 extends Exception> (Throwables.Function<? super T, ? extends K, throws E, E2, E3, IllegalStateExceptionE2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Supplier<? extends M> mapFactory) - Type Parameters:
K
- the key typeV
- the value typeM
-- Parameters:
keyMapper
-valueMapper
-mapFactory
-- Returns:
- Throws:
E
- the eIllegalStateException
- if there are duplicated keys.E2 extends Exception
E3 extends Exception
-
toMap
@TerminalOp public <K,V, Map<K,E2 extends Exception, E3 extends Exception, E4 extends Exception> V> toMap(Throwables.Function<? super T, ? extends K, throws E, E2, E3, E4E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Throwables.BinaryOperator<V, E4> mergeFunction) -
toMap
@TerminalOp public <K,V, M toMapM extends Map<K, V>, E2 extends Exception, E3 extends Exception, E4 extends Exception> (Throwables.Function<? super T, ? extends K, throws E, E2, E3, E4E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Throwables.BinaryOperator<V, E4> mergeFunction, Supplier<? extends M> mapFactory) -
toMap
@Deprecated @TerminalOp public final <K,A, Map<K,D, E2 extends Exception> D> toMap(Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper, Collector<? super T, A, D> downstream) Deprecated.replaced bygroupTo
-
toMap
@Deprecated @TerminalOp public final <K,A, M toMapD, M extends Map<K, D>, E2 extends Exception> (Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper, Collector<? super T, A, D> downstream, Supplier<? extends M> mapFactory) Deprecated.replaced bygroupTo
-
toMap
@Deprecated @TerminalOp public final <K,V, Map<K,A, D, E2 extends Exception, E3 extends Exception> D> toMap(Throwables.Function<? super T, ? extends K, throws E, E2, E3E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Collector<? super V, A, D> downstream) Deprecated.replaced bygroupTo
-
toMap
@Deprecated @TerminalOp public final <K,V, M toMapA, D, M extends Map<K, D>, E2 extends Exception, E3 extends Exception> (Throwables.Function<? super T, ? extends K, throws E, E2, E3E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Collector<? super V, A, D> downstream, Supplier<? extends M> mapFactory) Deprecated.replaced bygroupTo
-
groupTo
@TerminalOp public <K,E2 extends Exception> Map<K,List<T>> groupTo(Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper) -
groupTo
@TerminalOp public <K,M extends Map<K, M groupToList<T>>, E2 extends Exception> (Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper, Supplier<? extends M> mapFactory) -
groupTo
@TerminalOp public <K,V, Map<K,E2 extends Exception, E3 extends Exception> List<V>> groupTo(Throwables.Function<? super T, ? extends K, throws E, E2, E3E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper) -
groupTo
@TerminalOp public <K,V, M groupToM extends Map<K, List<V>>, E2 extends Exception, E3 extends Exception> (Throwables.Function<? super T, ? extends K, throws E, E2, E3E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Supplier<? extends M> mapFactory) -
groupTo
@TerminalOp public <K,A, Map<K,D, E2 extends Exception> D> groupTo(Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper, Collector<? super T, A, D> downstream) -
groupTo
@TerminalOp public <K,A, M groupToD, M extends Map<K, D>, E2 extends Exception> (Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper, Collector<? super T, A, D> downstream, Supplier<? extends M> mapFactory) -
groupTo
@TerminalOp public <K,V, Map<K,A, D, E2 extends Exception, E3 extends Exception> D> groupTo(Throwables.Function<? super T, ? extends K, throws E, E2, E3E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Collector<? super V, A, D> downstream) -
groupTo
@TerminalOp public <K,V, M groupToA, D, M extends Map<K, D>, E2 extends Exception, E3 extends Exception> (Throwables.Function<? super T, ? extends K, throws E, E2, E3E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Collector<? super V, A, D> downstream, Supplier<? extends M> mapFactory) -
partitionTo
@TerminalOp public <E2 extends Exception> Map<Boolean,List<T>> partitionTo(Throwables.Predicate<? super T, E2> predicate) throws E, E2 -
partitionTo
@TerminalOp public <A,D, Map<Boolean,E2 extends Exception> D> partitionTo(Throwables.Predicate<? super T, E2> predicate, Collector<? super T, throws E, E2A, D> downstream) -
toMultimap
@TerminalOp public <K,E2 extends Exception> ListMultimap<K,T> toMultimap(Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper) -
toMultimap
@TerminalOp public <K,V extends Collection<T>, M toMultimapM extends Multimap<K, T, V>, E2 extends Exception> (Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper, Supplier<? extends M> mapFactory) -
toMultimap
@TerminalOp public <K,V, ListMultimap<K,E2 extends Exception, E3 extends Exception> V> toMultimap(Throwables.Function<? super T, ? extends K, throws E, E2, E3E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper) -
toMultimap
@TerminalOp public <K,V, M toMultimapC extends Collection<V>, M extends Multimap<K, V, C>, E2 extends Exception, E3 extends Exception> (Throwables.Function<? super T, ? extends K, throws E, E2, E3E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Supplier<? extends M> mapFactory) -
toMultiset
-
toMultiset
-
toLongMultiset
-
toLongMultiset
@TerminalOp public LongMultiset<T> toLongMultiset(Supplier<? extends LongMultiset<T>> supplier) throws E -
toDataSet
The first row will be used as column names if its type is array or list, or obtain the column names from first row if its type is entity or map.- Returns:
- Throws:
E
-
toDataSet
If the specifiedcolumnNames
is null or empty, the first row will be used as column names if its type is array or list, or obtain the column names from first row if its type is entity or map.- Parameters:
columnNames
-- Returns:
- Throws:
E
-
sumInt
@TerminalOp public <E2 extends Exception> long sumInt(Throwables.ToIntFunction<? super T, E2> func) throws E, E2 -
sumLong
@TerminalOp public <E2 extends Exception> long sumLong(Throwables.ToLongFunction<? super T, E2> func) throws E, E2 -
sumDouble
@TerminalOp public <E2 extends Exception> double sumDouble(Throwables.ToDoubleFunction<? super T, E2> func) throws E, E2 -
averageInt
@TerminalOp public <E2 extends Exception> u.OptionalDouble averageInt(Throwables.ToIntFunction<? super T, E2> func) throws E, E2 -
averageLong
@TerminalOp public <E2 extends Exception> u.OptionalDouble averageLong(Throwables.ToLongFunction<? super T, E2> func) throws E, E2 -
averageDouble
@TerminalOp public <E2 extends Exception> u.OptionalDouble averageDouble(Throwables.ToDoubleFunction<? super T, E2> func) throws E, E2 -
reduce
@TerminalOp public <E2 extends Exception> u.Optional<T> reduce(Throwables.BinaryOperator<T, E2> accumulator) throws E, E2- Type Parameters:
E2
-- Parameters:
accumulator
-- Returns:
- Throws:
E
- the eE2
- the e2
-
reduce
@TerminalOp public <U,E2 extends Exception> U reduce(U identity, Throwables.BiFunction<U, ? super T, throws E, E2U, E2> accumulator) - Type Parameters:
U
-E2
-- Parameters:
identity
-accumulator
-- Returns:
- Throws:
E
- the eE2
- the e2
-
reduceUntil
@Beta @TerminalOp public <E2 extends Exception> u.Optional<T> reduceUntil(Throwables.BinaryOperator<T, E2> accumulator, Throwables.Predicate<? super T, throws E, E2E2> conditionToBreak) - Type Parameters:
E2
-- Parameters:
accumulator
-conditionToBreak
- the input parameter is the return value ofaccumulator
, not the element from this Stream. Returnstrue
to break the loop if you don't want to continue theaction
. Iteration on this stream will also be stopped when this flag is set totrue
.- Returns:
- Throws:
E
E2
-
reduceUntil
@Beta @TerminalOp public <U,E2 extends Exception> U reduceUntil(U identity, Throwables.BiFunction<U, ? super T, throws E, E2U, E2> accumulator, Throwables.Predicate<? super U, E2> conditionToBreak) - Type Parameters:
U
-E2
-- Parameters:
identity
-accumulator
-conditionToBreak
- the input parameter is the return value ofaccumulator
, not the element from this Stream. Returnstrue
to break the loop if you don't want to continue theaction
. Iteration on this stream will also be stopped when this flag is set totrue
.- Returns:
- Throws:
E
E2
-
collect
@TerminalOp public <R,E2 extends Exception, R collectE3 extends Exception> (Throwables.Supplier<R, E2> supplier, Throwables.BiConsumer<? super R, throws E, E2, E3? super T, E3> accumulator) - Type Parameters:
R
-E2
-E3
-- Parameters:
supplier
-accumulator
-- Returns:
- Throws:
E
- the eE2
- the e2E3
- the e3
-
collect
@TerminalOp public <R,RR, RR collectE2 extends Exception, E3 extends Exception, E4 extends Exception> (Throwables.Supplier<R, E2> supplier, Throwables.BiConsumer<? super R, throws E, E2, E3, E4? super T, E3> accumulator, Throwables.Function<? super R, ? extends RR, E4> finisher) - Type Parameters:
R
-RR
-E2
-E3
-E4
-- Parameters:
supplier
-accumulator
-finisher
-- Returns:
- Throws:
E
- the eE2
- the e2E3
- the e3E4
- the e4
-
collect
- Type Parameters:
R
-A
-- Parameters:
collector
-- Returns:
- Throws:
E
- the e
-
collectAndThen
@TerminalOp public <R,RR, RR collectAndThenA, E2 extends Exception> (Collector<? super T, A, throws E, E2R> collector, Throwables.Function<? super R, ? extends RR, E2> func) Collect and then.- Type Parameters:
R
-RR
-A
-E2
-- Parameters:
collector
-func
-- Returns:
- Throws:
E
- the eE2
- the e2
-
join
-
join
@TerminalOp public String join(CharSequence delimiter, CharSequence prefix, CharSequence suffix) throws E -
persist
- Throws:
E extends Exception
IOException
-
persist
- Throws:
E extends Exception
IOException
-
persist
@TerminalOp public long persist(Throwables.Function<? super T, String, throws E, IOExceptionIOException> toLine, File file) toCSV:final JSONSerializationConfig jsc = JSC.create().setBracketRootValue(false); final Throwables.Function<? super T, String, IOException> toLine = it -> N.toJSON(it, jsc); stream.persist(toLine, header, outputFile);
- Parameters:
toLine
-file
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(Throwables.Function<? super T, String, throws E, IOExceptionIOException> toLine, String header, String tail, File file) - Throws:
E extends Exception
IOException
-
persist
@TerminalOp public long persist(Throwables.Function<? super T, String, throws E, IOExceptionIOException> toLine, OutputStream os) - Throws:
E extends Exception
IOException
-
persist
@TerminalOp public long persist(Throwables.Function<? super T, String, throws E, IOExceptionIOException> toLine, Writer writer) toCSV:final JSONSerializationConfig jsc = JSC.create().setBracketRootValue(false); final Throwables.Function<? super T, String, IOException> toLine = it -> N.toJSON(it, jsc); stream.persist(toLine, header, outputFile);
- Parameters:
toLine
-writer
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(Throwables.Function<? super T, String, throws E, IOExceptionIOException> toLine, String header, String tail, Writer writer) - Throws:
E extends Exception
IOException
-
persist
@TerminalOp public long persist(Throwables.BiConsumer<? super T, Writer, throws E, IOExceptionIOException> writeLine, File file) - Throws:
E extends Exception
IOException
-
persist
@TerminalOp public long persist(Throwables.BiConsumer<? super T, Writer, throws E, IOExceptionIOException> writeLine, String header, String tail, File file) - Throws:
E extends Exception
IOException
-
persist
@TerminalOp public long persist(Throwables.BiConsumer<? super T, Writer, throws E, IOExceptionIOException> writeLine, Writer writer) - Throws:
E extends Exception
IOException
-
persist
@TerminalOp public long persist(Throwables.BiConsumer<? super T, Writer, throws E, IOExceptionIOException> writeLine, String header, String tail, Writer writer) - Throws:
E extends Exception
IOException
-
persist
@TerminalOp public long persist(Connection conn, String insertSQL, int batchSize, int batchInterval, Throwables.BiConsumer<? super T, ? super PreparedStatement, throws E, SQLExceptionSQLException> stmtSetter) - Throws:
E extends Exception
SQLException
-
persist
@TerminalOp public long persist(PreparedStatement stmt, int batchSize, int batchInterval, Throwables.BiConsumer<? super T, ? super PreparedStatement, throws E, SQLExceptionSQLException> stmtSetter) - Throws:
E extends Exception
SQLException
-
persistToCSV
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
file
-- Returns:
- Throws:
E
IOException
-
persistToCSV
@TerminalOp public long persistToCSV(Collection<String> csvHeaders, File file) throws E, IOException Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
csvHeaders
-file
-- Returns:
- Throws:
E
IOException
-
persistToCSV
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
os
-- Returns:
- Throws:
E
IOException
-
persistToCSV
@TerminalOp public long persistToCSV(Collection<String> csvHeaders, OutputStream os) throws E, IOException Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
csvHeaders
-os
-- Returns:
- Throws:
E
IOException
-
persistToCSV
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
writer
-- Returns:
- Throws:
E
IOException
-
persistToCSV
@TerminalOp public long persistToCSV(Collection<String> csvHeaders, Writer writer) throws E, IOException Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
headers
-writer
-- Returns:
- Throws:
E
IOException
-
println
-
unchecked
-
toJdkStream
-
cast
-
__
@Beta @IntermediateOp public <TT,EE extends Exception> ExceptionalStream<TT,EE> __(Function<? super ExceptionalStream<T, E>, ExceptionalStream<TT, EE>> transfer) - Type Parameters:
SS
-- Parameters:
transfer
-- Returns:
- Throws:
E
- the e
-
sps
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> sps(Function<? super Stream<T>, ? extends Stream<? extends R>> ops) Temporarily switch the stream to parallel stream for operationops
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
ops
-- Returns:
- See Also:
-
sps
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> sps(int maxThreadNum, Function<? super Stream<T>, ? extends Stream<? extends R>> ops) Temporarily switch the stream to parallel stream for operationops
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
maxThreadNum
-ops
-- Returns:
- See Also:
-
spsFilter
@Beta @IntermediateOp public ExceptionalStream<T,E> spsFilter(Throwables.Predicate<? super T, E> predicate) Temporarily switch the stream to parallel stream for operationfilter
and then switch back to sequence stream. -
spsMap
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> spsMap(Throwables.Function<? super T, ? extends R, E> mapper) Temporarily switch the stream to parallel stream for operationmap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
- See Also:
-
spsFlatMap
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> spsFlatMap(Throwables.Function<? super T, ? extends Stream<? extends R>, E> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
- See Also:
-
spsFlattMap
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> spsFlattMap(Throwables.Function<? super T, ? extends Collection<? extends R>, E> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
- See Also:
-
spsOnEach
@Beta @IntermediateOp public ExceptionalStream<T,E> spsOnEach(Throwables.Consumer<? super T, E> action) Temporarily switch the stream to parallel stream for operationonEach
and then switch back to sequence stream.- Parameters:
action
-- Returns:
- See Also:
-
spsFilter
@Beta @IntermediateOp public ExceptionalStream<T,E> spsFilter(int maxThreadNum, Throwables.Predicate<? super T, E> predicate) Temporarily switch the stream to parallel stream for operationfilter
and then switch back to sequence stream. -
spsMap
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> spsMap(int maxThreadNum, Throwables.Function<? super T, ? extends R, E> mapper) Temporarily switch the stream to parallel stream for operationmap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
- See Also:
-
spsFlatMap
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> spsFlatMap(int maxThreadNum, Throwables.Function<? super T, ? extends Stream<? extends R>, E> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
- See Also:
-
spsFlattMap
@Beta @IntermediateOp public <R> ExceptionalStream<R,E> spsFlattMap(int maxThreadNum, Throwables.Function<? super T, ? extends Collection<? extends R>, E> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
- See Also:
-
spsOnEach
@Beta @IntermediateOp public ExceptionalStream<T,E> spsOnEach(int maxThreadNum, Throwables.Consumer<? super T, E> action) Temporarily switch the stream to parallel stream for operationonEach
and then switch back to sequence stream.- Parameters:
action
-- Returns:
- See Also:
-
spsFilterE
@Beta @IntermediateOp public ExceptionalStream<T,Exception> spsFilterE(Throwables.Predicate<? super T, ? extends Exception> predicate) Temporarily switch the stream to parallel stream for operationfilter
and then switch back to sequence stream. -
spsMapE
@Beta @IntermediateOp public <U> ExceptionalStream<U,Exception> spsMapE(Throwables.Function<? super T, ? extends U, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationmap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
- See Also:
-
spsFlatMapE
@Beta @IntermediateOp public <R> ExceptionalStream<R,Exception> spsFlatMapE(Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
- See Also:
-
spsFlattMapE
@Beta @IntermediateOp public <R> ExceptionalStream<R,Exception> spsFlattMapE(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
- See Also:
-
spsOnEachE
@Beta @IntermediateOp public ExceptionalStream<T,Exception> spsOnEachE(Throwables.Consumer<? super T, ? extends Exception> action) Temporarily switch the stream to parallel stream for operationonEach
and then switch back to sequence stream.- Parameters:
action
-- Returns:
- See Also:
-
spsFilterE
@Beta @IntermediateOp public ExceptionalStream<T,Exception> spsFilterE(int maxThreadNum, Throwables.Predicate<? super T, ? extends Exception> predicate) Temporarily switch the stream to parallel stream for operationfilter
and then switch back to sequence stream.- Parameters:
maxThreadNum
-predicate
-- Returns:
- See Also:
-
spsMapE
@Beta @IntermediateOp public <U> ExceptionalStream<U,Exception> spsMapE(int maxThreadNum, Throwables.Function<? super T, ? extends U, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationmap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
maxThreadNum
-mapper
-- Returns:
- See Also:
-
spsFlatMapE
@Beta @IntermediateOp public <R> ExceptionalStream<R,Exception> spsFlatMapE(int maxThreadNum, Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
maxThreadNum
-mapper
-- Returns:
- See Also:
-
spsFlattMapE
@Beta @IntermediateOp public <R> ExceptionalStream<R,Exception> spsFlattMapE(int maxThreadNum, Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception> mapper) Temporarily switch the stream to parallel stream for operationflatMap
and then switch back to sequence stream.- Type Parameters:
R
-- Parameters:
maxThreadNum
-mapper
-- Returns:
- See Also:
-
spsOnEachE
@Beta @IntermediateOp public ExceptionalStream<T,Exception> spsOnEachE(int maxThreadNum, Throwables.Consumer<? super T, ? extends Exception> action) Temporarily switch the stream to parallel stream for operationonEach
and then switch back to sequence stream.- Parameters:
maxThreadNum
-action
-- Returns:
- See Also:
-
filterE
@Beta @IntermediateOp public ExceptionalStream<T,Exception> filterE(Throwables.Predicate<? super T, ? extends Exception> predicate) - Parameters:
predicate
-- Returns:
-
mapE
@Beta @IntermediateOp public <U> ExceptionalStream<U,Exception> mapE(Throwables.Function<? super T, ? extends U, ? extends Exception> mapper) - Type Parameters:
U
-- Parameters:
mapper
-- Returns:
-
flatMapE
@Beta @IntermediateOp public <R> ExceptionalStream<R,Exception> flatMapE(Throwables.Function<? super T, ? extends ExceptionalStream<? extends R, ? extends Exception>, ? extends Exception> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flattMapE
@Beta @IntermediateOp public <R> ExceptionalStream<R,Exception> flattMapE(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
onEachE
@Beta @IntermediateOp public ExceptionalStream<T,Exception> onEachE(Throwables.Consumer<? super T, ? extends Exception> action) - Parameters:
action
-- Returns:
-
asyncRun
@Beta @TerminalOp public ContinuableFuture<Void> asyncRun(Throwables.Consumer<? super ExceptionalStream<T, E>, ? extends Exception> terminalAction) - Parameters:
terminalAction
- a terminal operation should be called.- Returns:
-
asyncRun
@Beta @TerminalOp public ContinuableFuture<Void> asyncRun(Throwables.Consumer<? super ExceptionalStream<T, E>, ? extends Exception> terminalAction, Executor executor) - Parameters:
terminalAction
- a terminal operation should be called.executor
-- Returns:
-
asyncCall
@Beta @TerminalOp public <R> ContinuableFuture<R> asyncCall(Throwables.Function<? super ExceptionalStream<T, E>, R, ? extends Exception> terminalAction) - Type Parameters:
R
-- Parameters:
terminalAction
- a terminal operation should be called.- Returns:
-
asyncCall
@Beta @TerminalOp public <R> ContinuableFuture<R> asyncCall(Throwables.Function<? super ExceptionalStream<T, E>, R, ? extends Exception> terminalAction, Executor executor) - Type Parameters:
R
-- Parameters:
terminalAction
- a terminal operation should be called.executor
-- Returns:
-
onClose
@IntermediateOp public ExceptionalStream<T,E> onClose(Throwables.Runnable<? extends E> closeHandler) - Parameters:
closeHandler
-- Returns:
-
close
It will be called by terminal operations in final.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
E
- the e
-