Package com.landawn.abacus.util
Class CheckedStream<T,E extends Exception>
java.lang.Object
com.landawn.abacus.util.CheckedStream<T,E>
- Type Parameters:
T
-E
-
- All Implemented Interfaces:
Immutable
,Closeable
,AutoCloseable
@SequentialOnly
@Immutable
public final class CheckedStream<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:
-
BaseStream
Stream
IntStream
LongStream
DoubleStream
Collectorsa
Fn.Fnn
Comparators
ExceptionUtil
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
CheckedStream.CheckedIterator<T,
E extends Exception> The Class CheckedIterator. -
Method Summary
Modifier and TypeMethodDescription<TT,
EE extends Exception>
CheckedStream<TT,EE> __
(Function<? super CheckedStream<T, E>, CheckedStream<TT, EE>> transfer) Deprecated.acceptIfNotEmpty
(Throwables.Consumer<? super CheckedStream<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
(CheckedStream<T, E> s) append
(Collection<? extends T> c) final CheckedStream<T,
E> appendIfEmpty
(Throwables.Supplier<? extends CheckedStream<T, E>, ? extends E> supplier) Append if empty.appendIfEmpty
(Collection<? extends T> c) final CheckedStream<T,
E> appendIfEmpty
(T... a) <R,
E2 extends Exception>
u.Optional<R>applyIfNotEmpty
(Throwables.Function<? super CheckedStream<T, E>, R, E2> func) <R> ContinuableFuture<R>
asyncCall
(Throwables.Function<? super CheckedStream<T, E>, R, ? extends Exception> terminalAction) <R> ContinuableFuture<R>
asyncCall
(Throwables.Function<? super CheckedStream<T, E>, R, ? extends Exception> terminalAction, Executor executor) asyncRun
(Throwables.Consumer<? super CheckedStream<T, E>, ? extends Exception> terminalAction) asyncRun
(Throwables.Consumer<? super CheckedStream<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.CheckedStream<List<T>,
E> 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> CheckedStream<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>>
CheckedStream<C,E> collapse
(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, Supplier<? extends C> supplier) <R> CheckedStream<R,
E> collapse
(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, Collector<? super T, ?, R> collector) <U> CheckedStream<U,
E> collapse
(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, U init, Throwables.BiFunction<U, ? super T, U, ? extends E> op) CheckedStream<List<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.<R> CheckedStream<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>>
CheckedStream<C,E> collapse
(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, Supplier<? extends C> supplier) <R> CheckedStream<R,
E> collapse
(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, Collector<? super T, ?, R> collector) Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.<U> CheckedStream<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> R
<R,
RR, E2 extends Exception>
RRcollectAndThen
(Collector<? super T, ?, R> collector, Throwables.Function<? super R, ? extends RR, E2> func) Collect and then.static <T,
E extends Exception>
CheckedStream<T,E> concat
(CheckedStream<? extends T, E>... a) static <T,
E extends Exception>
CheckedStream<T,E> static <T,
E extends Exception>
CheckedStream<T,E> concat
(Collection<? extends CheckedStream<? extends T, E>> c) static <T,
E extends Exception>
CheckedStream<T,E> static <T,
E extends Exception>
CheckedStream<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> CheckedStream<Map.Entry<K,
Integer>, E> countBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper) cycled()
cycled
(long rounds) defaultIfEmpty
(Throwables.Supplier<? extends CheckedStream<T, E>, ? extends E> supplier) defaultIfEmpty
(T defaultValue) static <T,
E extends Exception>
CheckedStream<T,E> defer
(Throwables.Supplier<? extends CheckedStream<? extends T, ? extends E>, ? extends E> supplier) Lazy evaluation.difference
(Collection<?> c) <U> CheckedStream<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> CheckedStream<T,
E> distinctBy
(Throwables.Function<? super T, K, ? extends E> keyMapper) Distinct by the value mapped fromkeyMapper
.<K> CheckedStream<T,
E> distinctBy
(Throwables.Function<? super T, K, ? extends E> keyMapper, Throwables.BinaryOperator<T, ? extends E> mergeFunction) Distinct and filter by occurrences.<K> CheckedStream<T,
E> distinctBy
(Throwables.Function<? super T, K, ? extends E> keyMapper, Throwables.Predicate<? super Map.Entry<Keyed<K, T>, Long>, ? extends E> occurrencesFilter) Distinct and filter by occurrences.<K> CheckedStream<T,
E> distinctLimitBy
(Throwables.Function<? super T, K, ? extends E> keyMapper, Throwables.BiFunction<? super K, ? super List<T>, Integer, ? extends E> limit) Distinct and limit bykeyMapper
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>
CheckedStream<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> CheckedStream<R,
E> flatmap
(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E> mapper) <R> CheckedStream<R,
E> flatMap
(Throwables.Function<? super T, ? extends CheckedStream<? extends R, ? extends E>, ? extends E> mapper) <R> CheckedStream<R,
Exception> flatmapE
(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception> mapper) <R> CheckedStream<R,
Exception> flatMapE
(Throwables.Function<? super T, ? extends CheckedStream<? extends R, ? extends Exception>, ? extends Exception> mapper) <R> CheckedStream<R,
E> flatMapIfNotNull
(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E> mapper) <U,
R> CheckedStream<R, E> flatMapIfNotNull
(Throwables.Function<? super T, ? extends Collection<? extends U>, ? extends E> mapper, Throwables.Function<? super U, ? extends Collection<? extends R>, ? extends E> mapper2) 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> CheckedStream<R,
E> flattmap
(Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends E> mapper) <R> CheckedStream<R,
E> flattMap
(Throwables.Function<? super T, R[], ? extends E> mapper) <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 Iterable<? extends U>, E2> flatMapper, Throwables.BiConsumer<? super T, ? super U, E3> action) forEach
(Throwables.Function<? super T, ? extends Iterable<T2>, E2> flatMapper, Throwables.Function<? super T2, ? extends Iterable<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
(int threadNum, Throwables.Consumer<? super T, E2> action) <E2 extends Exception>
voidforEachInParallel
(int threadNum, Throwables.Consumer<? super T, E2> action, Executor executor) <E2 extends Exception>
voidforEachPair
(int increment, Throwables.BiConsumer<? super T, ? super T, E2> action) For each pair.<E2 extends Exception>
voidforEachPair
(Throwables.BiConsumer<? super T, ? super T, E2> action) For each pair.<E2 extends Exception>
voidforEachTriple
(int increment, 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) For each triple.<E2 extends Exception>
voidforEachUntil
(MutableBoolean flagToBreak, Throwables.Consumer<? super T, E2> action) Iterate and executeaction
untilflagToBreak
is set true.<E2 extends Exception>
voidforEachUntil
(Throwables.BiConsumer<? super T, MutableBoolean, E2> action) Iterate and executeaction
until the flag is set true.static <T,
E extends Exception>
CheckedStream<T,E> generate
(Throwables.Supplier<T, E> supplier) <K> CheckedStream<Map.Entry<K,
List<T>>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper) <K,
V> CheckedStream<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> CheckedStream<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> CheckedStream<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> CheckedStream<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, D> CheckedStream<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, ?, D> downstream) <K,
V, D> CheckedStream<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, ?, D> downstream, Supplier<? extends Map<K, D>> mapFactory) <K> CheckedStream<Map.Entry<K,
List<T>>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Supplier<? extends Map<K, List<T>>> mapFactory) <K,
D> CheckedStream<Map.Entry<K, D>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Collector<? super T, ?, D> downstream) <K,
D> CheckedStream<Map.Entry<K, D>, E> groupBy
(Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Collector<? super T, ?, 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, ?, D> downstream) groupTo
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Throwables.Function<? super T, ? extends V, E3> valueMapper, Collector<? super V, ?, 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, ?, D> downstream) groupTo
(Throwables.Function<? super T, ? extends K, E2> keyMapper, Collector<? super T, ?, D> downstream, Supplier<? extends M> mapFactory) boolean
indexed()
<U> CheckedStream<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>
CheckedStream<T,E> iterate
(Throwables.BooleanSupplier<? extends E> hasNext, Throwables.Supplier<? extends T, E> next) static <T,
E extends Exception>
CheckedStream<T,E> iterate
(T init, Throwables.BooleanSupplier<? extends E> hasNext, Throwables.UnaryOperator<T, ? extends E> f) static <T,
E extends Exception>
CheckedStream<T,E> iterate
(T init, Throwables.Predicate<? super T, ? extends E> hasNext, Throwables.UnaryOperator<T, ? extends E> f) static <T,
E extends Exception>
CheckedStream<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>
CheckedStream<T,E> just
(T e) static <T,
E extends Exception>
CheckedStream<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 CheckedStream<String,
IOException> static CheckedStream<String,
IOException> static CheckedStream<String,
IOException> static CheckedStream<String,
IOException> static CheckedStream<String,
IOException> static CheckedStream<File,
IOException> static CheckedStream<File,
IOException> <R> CheckedStream<R,
E> map
(Throwables.Function<? super T, ? extends R, ? extends E> mapper) <U> CheckedStream<U,
Exception> mapE
(Throwables.Function<? super T, ? extends U, ? extends Exception> mapper) mapFirst
(Throwables.Function<? super T, ? extends T, ? extends E> mapperForFirst) <R> CheckedStream<R,
E> mapFirstOrElse
(Throwables.Function<? super T, ? extends R, E> mapperForFirst, Throwables.Function<? super T, ? extends R, E> mapperForElse) <R> CheckedStream<R,
E> mapIfNotNull
(Throwables.Function<? super T, ? extends R, ? extends E> mapper) Convert the element to a new value if it's notnull
, otherwise skip it.mapLast
(Throwables.Function<? super T, ? extends T, ? extends E> mapperForLast) <R> CheckedStream<R,
E> mapLastOrElse
(Throwables.Function<? super T, ? extends R, E> mapperForLast, Throwables.Function<? super T, ? extends R, E> mapperForElse) <R> CheckedStream<R,
E> mapMulti
(Throwables.BiConsumer<? super T, ? super Consumer<R>, ? extends E> mapper) <R> CheckedStream<R,
E> mapPartial
(Throwables.Function<? super T, u.Optional<? extends R>, E> mapper) Note: copied from StreamEx: https://github.com/amaembo/streamex<R> CheckedStream<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>
CheckedStream<T,E> merge
(CheckedStream<? extends T, E> a, CheckedStream<? extends T, E> b, CheckedStream<? extends T, E> c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) static <T,
E extends Exception>
CheckedStream<T,E> merge
(CheckedStream<? extends T, E> a, CheckedStream<? extends T, E> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) static <T,
E extends Exception>
CheckedStream<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>
CheckedStream<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>
CheckedStream<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>
CheckedStream<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>
CheckedStream<T,E> merge
(T[] a, T[] b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) static <T,
E extends Exception>
CheckedStream<T,E> merge
(T[] a, T[] b, T[] c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) mergeWith
(CheckedStream<? 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>
CheckedStream<Boolean,E> of
(boolean[] a) static <E extends Exception>
CheckedStream<Byte,E> of
(byte[] a) static <E extends Exception>
CheckedStream<Character,E> of
(char[] a) static <E extends Exception>
CheckedStream<Double,E> of
(double[] a) static <E extends Exception>
CheckedStream<Float,E> of
(float[] a) static <E extends Exception>
CheckedStream<Integer,E> of
(int[] a) static <E extends Exception>
CheckedStream<Long,E> of
(long[] a) static <E extends Exception>
CheckedStream<Short,E> of
(short[] a) static <T,
E extends Exception>
CheckedStream<T,E> static <T,
E extends Exception>
CheckedStream<T,E> static <T,
E extends Exception>
CheckedStream<T,E> of
(u.Optional<T> op) static <T,
E extends Exception>
CheckedStream<T,E> static <T,
E extends Exception>
CheckedStream<T,E> static <T,
E extends Exception>
CheckedStream<T,E> of
(Collection<? extends T> c) static <T,
E extends Exception>
CheckedStream<T,E> of
(Collection<? extends T> c, Class<E> exceptionType) static <T,
E extends Exception>
CheckedStream<T,E> static <T,
E extends Exception>
CheckedStream<T,E> static <K,
V, E extends Exception>
CheckedStream<Map.Entry<K,V>, E> static <K,
V, E extends Exception>
CheckedStream<Map.Entry<K,V>, E> static <T,
E extends Exception>
CheckedStream<T,E> static <T,
E extends Exception>
CheckedStream<T,E> static <T,
E extends Exception>
CheckedStream<T,E> static <T,
E extends Exception>
CheckedStream<T,E> of
(T... a) static <K,
E extends Exception>
CheckedStream<K,E> static <K,
V, E extends Exception>
CheckedStream<K,E> ofKeys
(Map<K, V> map, Throwables.BiPredicate<? super K, ? super V, E> filter) static <K,
V, E extends Exception>
CheckedStream<K,E> ofKeys
(Map<K, V> map, Throwables.Predicate<? super V, E> valueFilter) static <T,
E extends Exception>
CheckedStream<T,E> ofNullable
(T e) Returns an emptyStream
if the specifiedt
is null.static <T,
E extends Exception>
CheckedStream<T,E> ofNullable
(T e, Class<E> exceptionType) Returns an emptyStream
if the specifiedt
is null.static <V,
E extends Exception>
CheckedStream<V,E> static <K,
V, E extends Exception>
CheckedStream<V,E> ofValues
(Map<K, V> map, Throwables.BiPredicate<? super K, ? super V, E> filter) static <K,
V, E extends Exception>
CheckedStream<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) onlyOne()
partitionBy
(Throwables.Predicate<? super T, E> predicate) <D> CheckedStream<Map.Entry<Boolean,
D>, E> partitionBy
(Throwables.Predicate<? super T, E> predicate, Collector<? super T, ?, D> downstream) partitionTo
(Throwables.Predicate<? super T, E2> predicate) partitionTo
(Throwables.Predicate<? super T, E2> predicate, Collector<? super T, ?, 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
long
persist
(File output, Throwables.BiConsumer<? super T, Writer, IOException> writeLine) long
long
long
persist
(File output, String header, String tail, Throwables.BiConsumer<? super T, Writer, IOException> writeLine) long
long
persist
(OutputStream output, Throwables.Function<? super T, String, E> toLine) long
persist
(OutputStream output, String header, String tail, Throwables.Function<? super T, String, E> toLine) long
persist
(Writer output, Throwables.BiConsumer<? super T, Writer, IOException> writeLine) long
long
persist
(Writer output, String header, String tail, Throwables.BiConsumer<? super T, Writer, IOException> writeLine) long
long
persist
(Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) long
persist
(PreparedStatement stmt, int batchSize, long batchIntervalInMillis, Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) long
persist
(DataSource ds, String insertSQL, int batchSize, long batchIntervalInMillis, Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) long
persistToCSV
(File output) Each line in the output file/Writer is an array of JSON String without root bracket.long
persistToCSV
(File output, Collection<String> csvHeaders) Each line in the output file/Writer is an array of JSON String without root bracket.long
persistToCSV
(OutputStream output) Each line in the output file/Writer is an array of JSON String without root bracket.long
persistToCSV
(OutputStream output, Collection<String> csvHeaders) Each line in the output file/Writer is an array of JSON String without root bracket.long
persistToCSV
(Writer output) Each line in the output file/Writer is an array of JSON String without root bracket.long
persistToCSV
(Writer output, Collection<String> csvHeaders) Each line in the output file/Writer is an array of JSON String without root bracket.prepend
(CheckedStream<T, E> s) prepend
(Collection<? extends T> c) final CheckedStream<T,
E> void
println()
static <E extends Exception>
CheckedStream<Integer,E> range
(int startInclusive, int endExclusive) static <E extends Exception>
CheckedStream<Integer,E> range
(int startInclusive, int endExclusive, int by) static <E extends Exception>
CheckedStream<Integer,E> rangeClosed
(int startInclusive, int endExclusive) static <E extends Exception>
CheckedStream<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>
CheckedStream<T,E> repeat
(T element, long n) reversed()
reverseSorted
(Comparator<? super T> comparator) reverseSortedBy
(Function<? super T, ? extends Comparable> keyMapper) reverseSortedByDouble
(ToDoubleFunction<? super T> keyMapper) reverseSortedByInt
(ToIntFunction<? super T> keyMapper) reverseSortedByLong
(ToLongFunction<? super T> keyMapper) rotated
(int distance) saveEach
(File output, Throwables.BiConsumer<? super T, Writer, IOException> writeLine) saveEach
(OutputStream output, Throwables.Function<? super T, String, E> toLine) saveEach
(Writer output, Throwables.BiConsumer<? super T, Writer, IOException> writeLine) saveEach
(Connection conn, String insertSQL, Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) To support batch call, please useonEach
oronEachE
.saveEach
(PreparedStatement stmt, Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) To support batch call, please useonEach
oronEachE
.saveEach
(DataSource ds, String insertSQL, Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) To support batch/parallel call, please useonEach
oronEachE
.<U> CheckedStream<U,
E> scan
(U init, Throwables.BiFunction<U, ? super T, U, ? extends E> accumulator) <U> CheckedStream<U,
E> scan
(U init, Throwables.BiFunction<U, ? super T, U, ? extends E> accumulator, boolean initIncluded) shuffled()
skip
(long n) skipLast
(int n) skipNull()
Deprecated.UseskipNulls()
insteadskipUntil
(Throwables.Predicate<? super T, ? extends E> predicate) sliding
(int windowSize, int increment) <C extends Collection<T>>
CheckedStream<C,E> sliding
(int windowSize, int increment, IntFunction<? extends C> collectionSupplier) <R> CheckedStream<R,
E> <R> CheckedStream<R,
E> slidingMap
(int increment, boolean ignoreNotPaired, Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper) <R> CheckedStream<R,
E> slidingMap
(int increment, boolean ignoreNotPaired, Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper) <R> CheckedStream<R,
E> slidingMap
(int increment, Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper) <R> CheckedStream<R,
E> slidingMap
(int increment, Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper) <R> CheckedStream<R,
E> slidingMap
(Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper) <R> CheckedStream<R,
E> slidingMap
(Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper) CheckedStream<List<T>,
E> slidingToList
(int windowSize, int increment) Sliding to list.CheckedStream<Set<T>,
E> slidingToSet
(int windowSize, int increment) Sliding to set.sorted()
sorted
(Comparator<? super T> comparator) sortedBy
(Function<? super T, ? extends Comparable> keyMapper) sortedByDouble
(ToDoubleFunction<? super T> keyMapper) sortedByInt
(ToIntFunction<? super T> keyMapper) sortedByLong
(ToLongFunction<? super T> keyMapper) split
(int chunkSize) <C extends Collection<T>>
CheckedStream<C,E> split
(int chunkSize, IntFunction<? extends C> collectionSupplier) Returns CheckedStream ofC
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).<R> CheckedStream<R,
E> static <E extends Exception>
CheckedStream<String,E> split
(CharSequence str, CharSequence delimiter) splitAt
(int where) splitAt
(Throwables.Predicate<? super T, ? extends E> where) CheckedStream<List<T>,
E> splitToList
(int chunkSize) Returns CheckedStream ofList<T>
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).CheckedStream<Set<T>,
E> splitToSet
(int chunkSize) Returns CheckedStream ofSet<T>
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).<R> CheckedStream<R,
E> Temporarily switch the stream to parallel stream for operationops
and then switch back to sequence stream.<R> CheckedStream<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> CheckedStream<R,
E> spsFlatmap
(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> CheckedStream<R,
E> spsFlatmap
(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> CheckedStream<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> CheckedStream<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> CheckedStream<R,
Exception> spsFlatmapE
(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> CheckedStream<R,
Exception> spsFlatmapE
(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> CheckedStream<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> CheckedStream<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> CheckedStream<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> CheckedStream<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> CheckedStream<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> CheckedStream<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) CheckedStream<Timed<T>,
E> timed()
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 bean 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 bean 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) <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) <TT,
EE extends Exception>
CheckedStream<TT,EE> transform
(Function<? super CheckedStream<T, E>, CheckedStream<TT, EE>> transfer) static <A,
B, T, E extends Exception>
CheckedStream<T,E> zip
(A[] a, B[] b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, ? extends 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>
CheckedStream<T,E> zip
(A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriFunction<? super A, ? super B, ? super C, ? extends 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>
CheckedStream<T,E> zip
(A[] a, B[] b, C[] c, Throwables.TriFunction<? super A, ? super B, ? super C, ? extends 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>
CheckedStream<T,E> zip
(A[] a, B[] b, Throwables.BiFunction<? super A, ? super B, ? extends 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>
CheckedStream<T,E> zip
(CheckedStream<? extends A, E> a, CheckedStream<? extends B, E> b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, ? extends 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>
CheckedStream<T,E> zip
(CheckedStream<? extends A, E> a, CheckedStream<? extends B, E> b, CheckedStream<? extends C, E> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriFunction<? super A, ? super B, ? super C, ? extends 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>
CheckedStream<T,E> zip
(CheckedStream<? extends A, E> a, CheckedStream<? extends B, E> b, CheckedStream<? extends C, E> c, Throwables.TriFunction<? super A, ? super B, ? super C, ? extends 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>
CheckedStream<T,E> zip
(CheckedStream<? extends A, E> a, CheckedStream<? extends B, E> b, Throwables.BiFunction<? super A, ? super B, ? extends 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>
CheckedStream<T,E> zip
(Iterable<? extends A> a, Iterable<? extends B> b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, ? extends 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>
CheckedStream<T,E> zip
(Iterable<? extends A> a, Iterable<? extends B> b, Throwables.BiFunction<? super A, ? super B, ? extends 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>
CheckedStream<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, ? extends 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>
CheckedStream<T,E> zip
(Iterable<? extends A> a, Iterable<? extends B> b, Iterable<? extends C> c, Throwables.TriFunction<? super A, ? super B, ? super C, ? extends 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>
CheckedStream<T,E> zip
(Iterator<? extends A> a, Iterator<? extends B> b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, ? extends 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>
CheckedStream<T,E> zip
(Iterator<? extends A> a, Iterator<? extends B> b, Throwables.BiFunction<? super A, ? super B, ? extends 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>
CheckedStream<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, ? extends 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>
CheckedStream<T,E> zip
(Iterator<? extends A> a, Iterator<? extends B> b, Iterator<? extends C> c, Throwables.TriFunction<? super A, ? super B, ? super C, ? extends T, ? extends E> zipFunction) Zip together the "a", "b" and "c" iterators until one of them runs out of values.<T2,
T3, R> CheckedStream<R, E> zipWith
(CheckedStream<T2, E> b, CheckedStream<T3, E> c, Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) <T2,
T3, R> CheckedStream<R, E> zipWith
(CheckedStream<T2, E> b, CheckedStream<T3, E> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) <T2,
R> CheckedStream<R, E> zipWith
(CheckedStream<T2, E> b, Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E> zipFunction) <T2,
R> CheckedStream<R, E> zipWith
(CheckedStream<T2, E> b, T valueForNoneA, T2 valueForNoneB, Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E> zipFunction) <T2,
R> CheckedStream<R, E> zipWith
(Collection<T2> b, Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E> zipFunction) <T2,
T3, R> CheckedStream<R, E> zipWith
(Collection<T2> b, Collection<T3> c, Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) <T2,
T3, R> CheckedStream<R, E> zipWith
(Collection<T2> b, Collection<T3> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) <T2,
R> CheckedStream<R, E> zipWith
(Collection<T2> b, T valueForNoneA, T2 valueForNoneB, Throwables.BiFunction<? super T, ? super T2, ? extends 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:
-
ofNullable
Returns an emptyStream
if the specifiedt
is null.- Type Parameters:
T
-E
-- Parameters:
e
-exceptionType
-- 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> CheckedStream<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> CheckedStream<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> CheckedStream<T,E> of(Iterable<? extends T> iterable, Class<E> exceptionType) - Type Parameters:
T
-E
-- Parameters:
iterable
-exceptionType
-- Returns:
-
of
public static <K,V, CheckedStream<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> CheckedStream<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> CheckedStream<T,E> of(Stream<? extends T> stream, Class<E> exceptionType) - Type Parameters:
T
-E
-- Parameters:
stream
-exceptionType
-- Returns:
-
of
- Type Parameters:
E
-- Parameters:
a
-- Returns:
-
of
- Type Parameters:
E
-- Parameters:
a
-- Returns:
-
of
- Type Parameters:
E
-- Parameters:
a
-- Returns:
-
of
- Type Parameters:
E
-- Parameters:
a
-- Returns:
-
of
- Type Parameters:
E
-- Parameters:
a
-- Returns:
-
of
- Type Parameters:
E
-- Parameters:
a
-- Returns:
-
of
- Type Parameters:
E
-- Parameters:
a
-- Returns:
-
of
- Type Parameters:
E
-- Parameters:
a
-- Returns:
-
of
- Type Parameters:
T
-E
-- Parameters:
op
-- Returns:
-
of
- Type Parameters:
T
-E
-- Parameters:
op
-- Returns:
-
ofKeys
- Type Parameters:
K
-E
-- Parameters:
map
-- Returns:
-
ofKeys
public static <K,V, CheckedStream<K,E extends Exception> E> ofKeys(Map<K, V> map, Throwables.Predicate<? super V, E> valueFilter) - Type Parameters:
K
-V
-E
-- Parameters:
map
-valueFilter
-- Returns:
-
ofKeys
public static <K,V, CheckedStream<K,E extends Exception> E> ofKeys(Map<K, V> map, Throwables.BiPredicate<? super K, ? super V, E> filter) - Type Parameters:
K
-V
-E
-- Parameters:
map
-filter
-- Returns:
-
ofValues
- Type Parameters:
V
-E
-- Parameters:
map
-- Returns:
-
ofValues
public static <K,V, CheckedStream<V,E extends Exception> E> ofValues(Map<K, V> map, Throwables.Predicate<? super K, E> keyFilter) - Type Parameters:
K
-V
-E
-- Parameters:
map
-keyFilter
-- Returns:
-
ofValues
public static <K,V, CheckedStream<V,E extends Exception> E> ofValues(Map<K, V> map, Throwables.BiPredicate<? super K, ? super V, E> filter) - Type Parameters:
K
-V
-E
-- Parameters:
map
-filter
-- Returns:
-
defer
public static <T,E extends Exception> CheckedStream<T,E> defer(Throwables.Supplier<? extends CheckedStream<? extends T, ? extends E>, ? extends E> supplier) Lazy evaluation.
This is equal to:CheckedStream.just(supplier).flatMap(Throwables.Supplier::get)
.- Type Parameters:
T
-E
-- Parameters:
supplier
-- Returns:
-
iterate
public static <T,E extends Exception> CheckedStream<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> CheckedStream<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> CheckedStream<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> CheckedStream<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> CheckedStream<T,E> generate(Throwables.Supplier<T, E> supplier) - Type Parameters:
T
-E
-- Parameters:
supplier
-- Returns:
-
repeat
- Type Parameters:
T
-E
-- Parameters:
element
-n
-- Returns:
-
range
public static <E extends Exception> CheckedStream<Integer,E> range(int startInclusive, int endExclusive) - Type Parameters:
E
-- Parameters:
startInclusive
-endExclusive
-- Returns:
-
range
public static <E extends Exception> CheckedStream<Integer,E> range(int startInclusive, int endExclusive, int by) - Type Parameters:
E
-- Parameters:
startInclusive
-endExclusive
-by
-- Returns:
-
rangeClosed
public static <E extends Exception> CheckedStream<Integer,E> rangeClosed(int startInclusive, int endExclusive) - Type Parameters:
E
-- Parameters:
startInclusive
-endExclusive
-- Returns:
-
rangeClosed
public static <E extends Exception> CheckedStream<Integer,E> rangeClosed(int startInclusive, int endExclusive, int by) - Type Parameters:
E
-- Parameters:
startInclusive
-endExclusive
-by
-- Returns:
-
split
public static <E extends Exception> CheckedStream<String,E> split(CharSequence str, CharSequence delimiter) - Type Parameters:
E
-- Parameters:
str
-delimiter
-- Returns:
-
lines
- Parameters:
file
-- Returns:
-
lines
- Parameters:
file
-charset
-- Returns:
-
lines
- Parameters:
path
-- Returns:
-
lines
- Parameters:
path
-charset
-- Returns:
-
lines
- Parameters:
reader
-- Returns:
-
listFiles
- Parameters:
parentPath
-- Returns:
-
listFiles
- Parameters:
parentPath
-recursively
-- Returns:
-
concat
- Type Parameters:
T
-E
-- Parameters:
a
-- Returns:
-
concat
@SafeVarargs public static <T,E extends Exception> CheckedStream<T,E> concat(Iterable<? extends T>... a) - Type Parameters:
T
-E
-- Parameters:
a
-- Returns:
-
concat
@SafeVarargs public static <T,E extends Exception> CheckedStream<T,E> concat(Iterator<? extends T>... a) - Type Parameters:
T
-E
-- Parameters:
a
-- Returns:
-
concat
@SafeVarargs public static <T,E extends Exception> CheckedStream<T,E> concat(CheckedStream<? extends T, E>... a) - Type Parameters:
T
-E
-- Parameters:
a
-- Returns:
-
concat
public static <T,E extends Exception> CheckedStream<T,E> concat(Collection<? extends CheckedStream<? extends T, E>> c) - Type Parameters:
T
-E
-- Parameters:
c
-- Returns:
-
zip
public static <A,B, CheckedStream<T,T, E extends Exception> E> zip(A[] a, B[] b, Throwables.BiFunction<? super A, ? super B, ? extends 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.- Type Parameters:
A
-B
-T
-E
-- Parameters:
a
-b
-zipFunction
-- Returns:
-
zip
public static <A,B, CheckedStream<T,C, T, E extends Exception> E> zip(A[] a, B[] b, C[] c, Throwables.TriFunction<? super A, ? super B, ? super C, ? extends 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.- Type Parameters:
A
-B
-C
-T
-E
-- Parameters:
a
-b
-c
-zipFunction
-- Returns:
-
zip
public static <A,B, CheckedStream<T,T, E extends Exception> E> zip(Iterable<? extends A> a, Iterable<? extends B> b, Throwables.BiFunction<? super A, ? super B, ? extends 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.- Type Parameters:
A
-B
-T
-E
-- Parameters:
a
-b
-zipFunction
-- Returns:
-
zip
public static <A,B, CheckedStream<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, ? extends 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.- Type Parameters:
A
-B
-C
-T
-E
-- Parameters:
a
-b
-c
-zipFunction
-- Returns:
-
zip
public static <A,B, CheckedStream<T,T, E extends Exception> E> zip(Iterator<? extends A> a, Iterator<? extends B> b, Throwables.BiFunction<? super A, ? super B, ? extends 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.- Type Parameters:
A
-B
-T
-E
-- Parameters:
a
-b
-zipFunction
-- Returns:
-
zip
public static <A,B, CheckedStream<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, ? extends 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.- Type Parameters:
A
-B
-C
-T
-E
-- Parameters:
a
-b
-c
-zipFunction
-- Returns:
-
zip
public static <A,B, CheckedStream<T,T, E extends Exception> E> zip(CheckedStream<? extends A, E> a, CheckedStream<? extends B, E> b, Throwables.BiFunction<? super A, ? super B, ? extends 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.- Type Parameters:
A
-B
-T
-E
-- Parameters:
a
-b
-zipFunction
-- Returns:
-
zip
public static <A,B, CheckedStream<T,C, T, E extends Exception> E> zip(CheckedStream<? extends A, E> a, CheckedStream<? extends B, E> b, CheckedStream<? extends C, E> c, Throwables.TriFunction<? super A, ? super B, ? super C, ? extends 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.- Type Parameters:
A
-B
-C
-T
-E
-- Parameters:
a
-b
-c
-zipFunction
-- Returns:
-
zip
public static <A,B, CheckedStream<T,T, E extends Exception> E> zip(A[] a, B[] b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, ? extends 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.- Type Parameters:
A
-B
-T
-E
-- 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, CheckedStream<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, ? extends 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.- Type Parameters:
A
-B
-C
-T
-E
-- 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, CheckedStream<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, ? extends 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.- Type Parameters:
A
-B
-T
-E
-- 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, CheckedStream<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, ? extends 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.- Type Parameters:
A
-B
-C
-T
-E
-- 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, CheckedStream<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, ? extends 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.- Type Parameters:
A
-B
-T
-E
-- 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, CheckedStream<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, ? extends 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.- Type Parameters:
A
-B
-C
-T
-E
-- 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, CheckedStream<T,T, E extends Exception> E> zip(CheckedStream<? extends A, E> a, CheckedStream<? extends B, E> b, A valueForNoneA, B valueForNoneB, Throwables.BiFunction<? super A, ? super B, ? extends 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.- Type Parameters:
A
-B
-T
-E
-- Parameters:
a
-b
-valueForNoneA
-valueForNoneB
-zipFunction
-- Returns:
-
zip
public static <A,B, CheckedStream<T,C, T, E extends Exception> E> zip(CheckedStream<? extends A, E> a, CheckedStream<? extends B, E> b, CheckedStream<? extends C, E> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriFunction<? super A, ? super B, ? super C, ? extends 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.- Type Parameters:
A
-B
-C
-T
-E
-- Parameters:
a
-b
-c
-valueForNoneA
-valueForNoneB
-valueForNoneC
-zipFunction
-- Returns:
-
merge
public static <T,E extends Exception> CheckedStream<T,E> merge(T[] a, T[] b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Type Parameters:
T
-E
-- 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> CheckedStream<T,E> merge(T[] a, T[] b, T[] c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Type Parameters:
T
-E
-- 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> CheckedStream<T,E> merge(Iterable<? extends T> a, Iterable<? extends T> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Type Parameters:
T
-E
-- 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> CheckedStream<T,E> merge(Iterable<? extends T> a, Iterable<? extends T> b, Iterable<? extends T> c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Type Parameters:
T
-E
-- 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> CheckedStream<T,E> merge(Iterator<? extends T> a, Iterator<? extends T> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Type Parameters:
T
-E
-- 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> CheckedStream<T,E> merge(Iterator<? extends T> a, Iterator<? extends T> b, Iterator<? extends T> c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Type Parameters:
T
-E
-- 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> CheckedStream<T,E> merge(CheckedStream<? extends T, E> a, CheckedStream<? extends T, E> b, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Type Parameters:
T
-E
-- 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> CheckedStream<T,E> merge(CheckedStream<? extends T, E> a, CheckedStream<? extends T, E> b, CheckedStream<? extends T, E> c, Throwables.BiFunction<? super T, ? super T, MergeResult, E> nextSelector) - Type Parameters:
T
-E
-- Parameters:
a
-b
-c
-nextSelector
-- Returns:
-
filter
@IntermediateOp public CheckedStream<T,E> filter(Throwables.Predicate<? super T, ? extends E> predicate) - Parameters:
predicate
-- Returns:
-
filter
@IntermediateOp public CheckedStream<T,E> filter(Throwables.Predicate<? super T, ? extends E> predicate, Throwables.Consumer<? super T, ? extends E> actionOnDroppedItem) - Parameters:
predicate
-actionOnDroppedItem
-- Returns:
-
takeWhile
@IntermediateOp public CheckedStream<T,E> takeWhile(Throwables.Predicate<? super T, ? extends E> predicate) - Parameters:
predicate
-- Returns:
-
dropWhile
@IntermediateOp public CheckedStream<T,E> dropWhile(Throwables.Predicate<? super T, ? extends E> predicate) - Parameters:
predicate
-- Returns:
-
dropWhile
@IntermediateOp public CheckedStream<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 CheckedStream<T,E> skipUntil(Throwables.Predicate<? super T, ? extends E> predicate) - Parameters:
predicate
-- Returns:
-
distinct
Distinct and filter by occurrences.- Returns:
-
distinct
@IntermediateOp @TerminalOpTriggered public CheckedStream<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 CheckedStream<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> CheckedStream<T,E> distinctBy(Throwables.Function<? super T, K, ? extends E> keyMapper) Distinct by the value mapped fromkeyMapper
.- Type Parameters:
K
-- Parameters:
keyMapper
- don't change value of the input parameter.- Returns:
-
distinctBy
@IntermediateOp @TerminalOpTriggered public <K> CheckedStream<T,E> distinctBy(Throwables.Function<? super T, K, ? extends E> keyMapper, Throwables.BinaryOperator<T, ? extends E> mergeFunction) Distinct and filter by occurrences.- Type Parameters:
K
-- Parameters:
keyMapper
-mergeFunction
-- Returns:
- See Also:
-
#groupBy(Function, Function, BinaryOperator)
-
distinctBy
@IntermediateOp @TerminalOpTriggered public <K> CheckedStream<T,E> distinctBy(Throwables.Function<? super T, K, ? extends E> keyMapper, Throwables.Predicate<? super Map.Entry<Keyed<K, T>, Long>, ? extends E> occurrencesFilter) Distinct and filter by occurrences.- Type Parameters:
K
-- Parameters:
keyMapper
-occurrencesFilter
-- Returns:
- See Also:
-
#groupBy(Function, Collector)
-
distinctLimitBy
@IntermediateOp @TerminalOpTriggered public <K> CheckedStream<T,E> distinctLimitBy(Throwables.Function<? super T, K, ? extends E> keyMapper, Throwables.BiFunction<? super K, ? super List<T>, Integer, ? extends E> limit) Distinct and limit bykeyMapper
- Type Parameters:
K
-- Parameters:
keyMapper
-limit
-- Returns:
- See Also:
-
#groupBy(Function, Collector)
-
map
@IntermediateOp public <R> CheckedStream<R,E> map(Throwables.Function<? super T, ? extends R, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
mapIfNotNull
@Beta @IntermediateOp public <R> CheckedStream<R,E> mapIfNotNull(Throwables.Function<? super T, ? extends R, ? extends E> mapper) Convert the element to a new value if it's notnull
, otherwise skip it.- Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
mapFirst
@IntermediateOp public CheckedStream<T,E> mapFirst(Throwables.Function<? super T, ? extends T, ? extends E> mapperForFirst) - Parameters:
mapperForFirst
-- Returns:
-
mapFirstOrElse
@IntermediateOp public <R> CheckedStream<R,E> mapFirstOrElse(Throwables.Function<? super T, ? extends R, E> mapperForFirst, Throwables.Function<? super T, ? extends R, E> mapperForElse) - Type Parameters:
R
-- Parameters:
mapperForFirst
-mapperForElse
-- Returns:
-
mapLast
@IntermediateOp public CheckedStream<T,E> mapLast(Throwables.Function<? super T, ? extends T, ? extends E> mapperForLast) - Parameters:
mapperForLast
-- Returns:
-
mapLastOrElse
@IntermediateOp public <R> CheckedStream<R,E> mapLastOrElse(Throwables.Function<? super T, ? extends R, E> mapperForLast, Throwables.Function<? super T, ? extends R, E> mapperForElse) - Type Parameters:
R
-- Parameters:
mapperForLast
-mapperForElse
-- Returns:
-
flatMap
@IntermediateOp public <R> CheckedStream<R,E> flatMap(Throwables.Function<? super T, ? extends CheckedStream<? extends R, ? extends E>, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatmap
@IntermediateOp public <R> CheckedStream<R,E> flatmap(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flattMap
@IntermediateOp public <R> CheckedStream<R,E> flattMap(Throwables.Function<? super T, R[], ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flattmap
@Beta @IntermediateOp public <R> CheckedStream<R,E> flattmap(Throwables.Function<? super T, ? extends Stream<? extends R>, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatMapIfNotNull
@Beta @IntermediateOp public <R> CheckedStream<R,E> flatMapIfNotNull(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatMapIfNotNull
@Beta @IntermediateOp public <U,R> CheckedStream<R,E> flatMapIfNotNull(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 CheckedStream<Boolean,E> flatMapToBoolean(Throwables.Function<? super T, boolean[], ? extends E> mapper) - Parameters:
mapper
-- Returns:
-
flatMapToChar
@Beta @IntermediateOp public CheckedStream<Character,E> flatMapToChar(Throwables.Function<? super T, char[], ? extends E> mapper) - Parameters:
mapper
-- Returns:
-
flatMapToByte
@Beta @IntermediateOp public CheckedStream<Byte,E> flatMapToByte(Throwables.Function<? super T, byte[], ? extends E> mapper) - Parameters:
mapper
-- Returns:
-
flatMapToShort
@Beta @IntermediateOp public CheckedStream<Short,E> flatMapToShort(Throwables.Function<? super T, short[], ? extends E> mapper) - Parameters:
mapper
-- Returns:
-
flatMapToInteger
@Beta @IntermediateOp public CheckedStream<Integer,E> flatMapToInteger(Throwables.Function<? super T, int[], ? extends E> mapper) - Parameters:
mapper
-- Returns:
-
flatMapToLong
@Beta @IntermediateOp public CheckedStream<Long,E> flatMapToLong(Throwables.Function<? super T, long[], ? extends E> mapper) - Parameters:
mapper
-- Returns:
-
flatMapToFloat
@Beta @IntermediateOp public CheckedStream<Float,E> flatMapToFloat(Throwables.Function<? super T, float[], ? extends E> mapper) - Parameters:
mapper
-- Returns:
-
flatMapToDouble
@Beta @IntermediateOp public CheckedStream<Double,E> flatMapToDouble(Throwables.Function<? super T, double[], ? extends E> mapper) - Parameters:
mapper
-- Returns:
-
mapPartial
@Beta @IntermediateOp public <R> CheckedStream<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 CheckedStream<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 CheckedStream<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 CheckedStream<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> CheckedStream<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 CheckedStream<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 CheckedStream<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 CheckedStream<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> CheckedStream<R,E> mapMulti(Throwables.BiConsumer<? super T, ? super Consumer<R>, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
slidingMap
@IntermediateOp public <R> CheckedStream<R,E> slidingMap(Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
slidingMap
@IntermediateOp public <R> CheckedStream<R,E> slidingMap(int increment, Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
increment
-mapper
-- Returns:
-
slidingMap
@IntermediateOp public <R> CheckedStream<R,E> slidingMap(int increment, boolean ignoreNotPaired, Throwables.BiFunction<? super T, ? super T, R, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
increment
-ignoreNotPaired
-mapper
-- Returns:
-
slidingMap
@IntermediateOp public <R> CheckedStream<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> CheckedStream<R,E> slidingMap(int increment, Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
increment
-mapper
-- Returns:
-
slidingMap
@IntermediateOp public <R> CheckedStream<R,E> slidingMap(int increment, boolean ignoreNotPaired, Throwables.TriFunction<? super T, ? super T, ? super T, R, ? extends E> mapper) - Type Parameters:
R
-- Parameters:
increment
-ignoreNotPaired
-mapper
-- Returns:
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K> CheckedStream<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> CheckedStream<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> CheckedStream<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> CheckedStream<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> CheckedStream<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> CheckedStream<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,D> CheckedStream<Map.Entry<K,D>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Collector<? super T, ?, D> downstream) - Type Parameters:
K
- the key typeD
-- Parameters:
keyMapper
-downstream
-- Returns:
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K,D> CheckedStream<Map.Entry<K,D>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Collector<? super T, ?, D> downstream, Supplier<? extends Map<K, D>> mapFactory) - Type Parameters:
K
- the key typeD
-- Parameters:
keyMapper
-downstream
-mapFactory
-- Returns:
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K,V, CheckedStream<Map.Entry<K,D> D>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Collector<? super V, ?, D> downstream) - Type Parameters:
K
- the key typeV
- the value typeD
-- Parameters:
keyMapper
-valueMapper
-downstream
-- Returns:
-
groupBy
@IntermediateOp @TerminalOpTriggered public <K,V, CheckedStream<Map.Entry<K,D> D>, groupByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper, Throwables.Function<? super T, ? extends V, ? extends E> valueMapper, Collector<? super V, ?, D> downstream, Supplier<? extends Map<K, D>> mapFactory) - Type Parameters:
K
- the key typeV
- the value typeD
-- Parameters:
keyMapper
-valueMapper
-downstream
-mapFactory
-- Returns:
-
partitionBy
@IntermediateOp @TerminalOpTriggered public CheckedStream<Map.Entry<Boolean,List<T>>, partitionByE> (Throwables.Predicate<? super T, E> predicate) - Parameters:
predicate
-- Returns:
- See Also:
-
partitionBy
@IntermediateOp @TerminalOpTriggered public <D> CheckedStream<Map.Entry<Boolean,D>, partitionByE> (Throwables.Predicate<? super T, E> predicate, Collector<? super T, ?, D> downstream) - Type Parameters:
D
-- Parameters:
predicate
-downstream
-- Returns:
- See Also:
-
countBy
@IntermediateOp @TerminalOpTriggered public <K> CheckedStream<Map.Entry<K,Integer>, countByE> (Throwables.Function<? super T, ? extends K, ? extends E> keyMapper) - Type Parameters:
K
-- Parameters:
keyMapper
-- Returns:
-
collapse
@IntermediateOp public CheckedStream<List<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>> CheckedStream<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 CheckedStream<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:
CheckedStream.of(new Integer[0]).collapse((p, c) -> p < c, (r, c) -> r + c) => [] CheckedStream.of(1).collapse((p, c) -> p < c, (r, c) -> r + c) => [1] CheckedStream.of(1, 2).collapse((p, c) -> p < c, (r, c) -> r + c) => [3] CheckedStream.of(1, 2, 3).collapse((p, c) -> p < c, (r, c) -> r + c) => [6] CheckedStream.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> CheckedStream<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> CheckedStream<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> CheckedStream<R,E> collapse(Throwables.BiPredicate<? super T, ? super T, ? extends E> collapsible, Collector<? super T, ?, R> collector) - 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.collector
-- Returns:
-
collapse
@IntermediateOp public CheckedStream<List<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>> CheckedStream<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 CheckedStream<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> CheckedStream<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> CheckedStream<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> CheckedStream<R,E> collapse(Throwables.TriPredicate<? super T, ? super T, ? super T, ? extends E> collapsible, Collector<? super T, ?, R> collector) Merge series of adjacent elements which satisfy the given predicate using the merger function and return a new stream.Example:
CheckedStream.of(new Integer[0]).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [] CheckedStream.of(1).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [1] CheckedStream.of(1, 2).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [3] CheckedStream.of(1, 2, 3).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [6] CheckedStream.of(1, 2, 3, 3, 2, 1).collapse((f, p, c) -> f < c, Collectors.summingInt(Fn.unboxI())) => [11, 1]
- 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.collector
-- Returns:
-
scan
@IntermediateOp public CheckedStream<T,E> scan(Throwables.BiFunction<? super T, ? super T, T, ? extends E> accumulator) - Parameters:
accumulator
-- Returns:
-
scan
@IntermediateOp public <U> CheckedStream<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> CheckedStream<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> CheckedStream<T,E> intersection(Throwables.Function<? super T, ? extends U, E> mapper, Collection<U> c) - Type Parameters:
U
-- Parameters:
mapper
-c
-- Returns:
- See Also:
-
difference
- Parameters:
c
-- Returns:
- See Also:
-
difference
- Type Parameters:
U
-- Parameters:
mapper
-c
-- Returns:
- See Also:
-
symmetricDifference
- Parameters:
c
-- Returns:
- See Also:
-
defaultIfEmpty
- Parameters:
defaultValue
-- Returns:
- See Also:
-
defaultIfEmpty
@IntermediateOp public CheckedStream<T,E> defaultIfEmpty(Throwables.Supplier<? extends CheckedStream<T, E>, ? extends E> supplier) - Parameters:
supplier
-- Returns:
- See Also:
-
prepend
- Parameters:
a
-- Returns:
-
prepend
- Parameters:
c
-- Returns:
-
prepend
- Parameters:
s
-- Returns:
-
append
- Parameters:
a
-- Returns:
-
append
- Parameters:
c
-- Returns:
-
append
- Parameters:
s
-- Returns:
-
appendIfEmpty
- Parameters:
a
-- Returns:
-
appendIfEmpty
- Parameters:
c
-- Returns:
-
appendIfEmpty
@IntermediateOp public CheckedStream<T,E> appendIfEmpty(Throwables.Supplier<? extends CheckedStream<T, E>, ? extends E> supplier) Append if empty.- Parameters:
supplier
-- Returns:
-
throwIfEmpty
- Parameters:
exceptionSupplier
-- Returns:
-
applyIfNotEmpty
@TerminalOp public <R,E2 extends Exception> u.Optional<R> applyIfNotEmpty(Throwables.Function<? super CheckedStream<T, E>, throws E, E2R, E2> func) - Type Parameters:
R
-E2
-- Parameters:
func
-- Returns:
- Throws:
E
E2
-
acceptIfNotEmpty
@TerminalOp public <E2 extends Exception> If.OrElse acceptIfNotEmpty(Throwables.Consumer<? super CheckedStream<T, E>, throws E, E2E2> action) - Type Parameters:
E2
-- Parameters:
action
-- Returns:
- Throws:
E
E2
-
onEach
- Parameters:
action
-- Returns:
-
peek
- Parameters:
action
-- Returns:
-
peekFirst
@IntermediateOp public CheckedStream<T,E> peekFirst(Throwables.Consumer<? super T, ? extends E> action) - Parameters:
action
-- Returns:
-
peekLast
@IntermediateOp public CheckedStream<T,E> peekLast(Throwables.Consumer<? super T, ? extends E> action) - Parameters:
action
-- Returns:
-
peekIf
@IntermediateOp public CheckedStream<T,E> peekIf(Throwables.Predicate<? super T, E> predicate, Throwables.Consumer<? super T, E> action) - Parameters:
predicate
-action
-- Returns:
-
peekIf
@Beta @IntermediateOp public CheckedStream<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 CheckedStream 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 CheckedStream 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>> CheckedStream<C,E> split(int chunkSize, IntFunction<? extends C> collectionSupplier) Returns CheckedStream 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> CheckedStream<R,E> split(int chunkSize, Collector<? super T, ?, R> collector) - Type Parameters:
R
-- Parameters:
chunkSize
- the desired size of each sub sequence (the last may be smaller).collector
-- Returns:
-
splitAt
- Parameters:
where
-- Returns:
-
splitAt
@IntermediateOp public CheckedStream<CheckedStream<T,E>, splitAtE> (Throwables.Predicate<? super T, ? extends E> where) - Parameters:
where
-- Returns:
-
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>> CheckedStream<C,E> sliding(int windowSize, int increment, IntFunction<? extends C> collectionSupplier) - Type Parameters:
C
-- Parameters:
windowSize
-increment
-collectionSupplier
-- Returns:
-
sliding
@IntermediateOp public <R> CheckedStream<R,E> sliding(int windowSize, int increment, Collector<? super T, ?, R> collector) - Type Parameters:
R
-- Parameters:
windowSize
-increment
-collector
-- Returns:
-
skip
- Parameters:
n
-- Returns:
-
skipNull
Deprecated.UseskipNulls()
instead- Returns:
-
skipNulls
- Returns:
-
limit
- Parameters:
maxSize
-- Returns:
-
top
- Parameters:
n
-- Returns:
-
top
- Parameters:
n
-comparator
-- Returns:
-
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
- Parameters:
n
-- Returns:
-
reversed
- Returns:
-
rotated
- Parameters:
distance
-- Returns:
-
shuffled
- Returns:
-
shuffled
- Parameters:
rnd
-- Returns:
-
sorted
- Returns:
-
sorted
@IntermediateOp @TerminalOpTriggered public CheckedStream<T,E> sorted(Comparator<? super T> comparator) - Parameters:
comparator
-- Returns:
-
sortedByInt
@IntermediateOp @TerminalOpTriggered public CheckedStream<T,E> sortedByInt(ToIntFunction<? super T> keyMapper) -
sortedByLong
@IntermediateOp @TerminalOpTriggered public CheckedStream<T,E> sortedByLong(ToLongFunction<? super T> keyMapper) -
sortedByDouble
@IntermediateOp @TerminalOpTriggered public CheckedStream<T,E> sortedByDouble(ToDoubleFunction<? super T> keyMapper) -
sortedBy
@IntermediateOp @TerminalOpTriggered public CheckedStream<T,E> sortedBy(Function<? super T, ? extends Comparable> keyMapper) - Parameters:
keyMapper
-- Returns:
-
reverseSorted
- Returns:
-
reverseSorted
@IntermediateOp @TerminalOpTriggered public CheckedStream<T,E> reverseSorted(Comparator<? super T> comparator) - Parameters:
comparator
-- Returns:
-
reverseSortedByInt
@IntermediateOp @TerminalOpTriggered public CheckedStream<T,E> reverseSortedByInt(ToIntFunction<? super T> keyMapper) -
reverseSortedByLong
@IntermediateOp @TerminalOpTriggered public CheckedStream<T,E> reverseSortedByLong(ToLongFunction<? super T> keyMapper) -
reverseSortedByDouble
@IntermediateOp @TerminalOpTriggered public CheckedStream<T,E> reverseSortedByDouble(ToDoubleFunction<? super T> keyMapper) -
reverseSortedBy
@IntermediateOp @TerminalOpTriggered public CheckedStream<T,E> reverseSortedBy(Function<? super T, ? extends Comparable> keyMapper) - Parameters:
keyMapper
-- Returns:
-
cycled
- Returns:
-
cycled
- Parameters:
rounds
-- Returns:
-
rateLimited
- Parameters:
permitsPerSecond
-- Returns:
-
rateLimited
- Parameters:
rateLimiter
-- Returns:
- See Also:
-
delay
- Parameters:
delay
-- Returns:
-
timed
- Returns:
-
intersperse
- Parameters:
delimiter
-- Returns:
-
step
- Parameters:
step
-- Returns:
-
indexed
- Returns:
-
mergeWith
@IntermediateOp public CheckedStream<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 CheckedStream<T,E> mergeWith(CheckedStream<? 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> CheckedStream<R,E> zipWith(Collection<T2> b, Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E> zipFunction) - Type Parameters:
T2
-R
-- Parameters:
b
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,R> CheckedStream<R,E> zipWith(Collection<T2> b, T valueForNoneA, T2 valueForNoneB, Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E> zipFunction) - Type Parameters:
T2
-R
-- Parameters:
b
-valueForNoneA
-valueForNoneB
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,T3, CheckedStream<R,R> E> zipWith(Collection<T2> b, Collection<T3> c, Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) - Type Parameters:
T2
-T3
-R
-- Parameters:
b
-c
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,T3, CheckedStream<R,R> E> zipWith(Collection<T2> b, Collection<T3> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) - Type Parameters:
T2
-T3
-R
-- Parameters:
b
-c
-valueForNoneA
-valueForNoneB
-valueForNoneC
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,R> CheckedStream<R,E> zipWith(CheckedStream<T2, E> b, Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E> zipFunction) - Type Parameters:
T2
-R
-- Parameters:
b
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,R> CheckedStream<R,E> zipWith(CheckedStream<T2, E> b, T valueForNoneA, T2 valueForNoneB, Throwables.BiFunction<? super T, ? super T2, ? extends R, ? extends E> zipFunction) - Type Parameters:
T2
-R
-- Parameters:
b
-valueForNoneA
-valueForNoneB
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,T3, CheckedStream<R,R> E> zipWith(CheckedStream<T2, E> b, CheckedStream<T3, E> c, Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) - Type Parameters:
T2
-T3
-R
-- Parameters:
b
-c
-zipFunction
-- Returns:
-
zipWith
@IntermediateOp public <T2,T3, CheckedStream<R,R> E> zipWith(CheckedStream<T2, E> b, CheckedStream<T3, E> c, T valueForNoneA, T2 valueForNoneB, T3 valueForNoneC, Throwables.TriFunction<? super T, ? super T2, ? super T3, ? extends R, ? extends E> zipFunction) - Type Parameters:
T2
-T3
-R
-- Parameters:
b
-c
-valueForNoneA
-valueForNoneB
-valueForNoneC
-zipFunction
-- Returns:
-
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) Iterate and executeaction
until the flag is set true. Flag can only be set after at least one element is iterated and executed byaction
.- 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
- See Also:
-
forEachUntil
@Beta @TerminalOp public <E2 extends Exception> void forEachUntil(MutableBoolean flagToBreak, Throwables.Consumer<? super T, E2> action) throws E, E2Iterate and executeaction
untilflagToBreak
is set true. IfflagToBreak
is set to true at the begin, there will be no element iterated from stream before this stream is stopped and closed.- 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 Iterable<? 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 Iterable<T2>, throws E, E2, E3, E4E2> flatMapper, Throwables.Function<? super T2, ? extends Iterable<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(int increment, Throwables.BiConsumer<? super T, ? super T, throws E, E2E2> action) For each pair.- Type Parameters:
E2
-- Parameters:
increment
-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) For each triple.- Type Parameters:
E2
-- Parameters:
action
-- Throws:
E
- the eE2
- the e2
-
forEachTriple
@TerminalOp public <E2 extends Exception> void forEachTriple(int increment, Throwables.TriConsumer<? super T, ? super T, throws E, E2? super T, E2> action) For each triple.- Type Parameters:
E2
-- Parameters:
increment
-action
-- Throws:
E
- the eE2
- the e2
-
forEachInParallel
@Beta @TerminalOp public <E2 extends Exception> void forEachInParallel(int threadNum, Throwables.Consumer<? super T, E2> action) throws E, E2- Type Parameters:
E2
-- Parameters:
threadNum
-action
-- Throws:
E
- the eE2
- the e2
-
forEachInParallel
@Beta @TerminalOp public <E2 extends Exception> void forEachInParallel(int threadNum, Throwables.Consumer<? super T, E2> action, Executor executor) throws E, E2- Type Parameters:
E2
-- Parameters:
threadNum
-action
-executor
-- 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
- Parameters:
a
-- Returns:
- Throws:
E
-
containsAll
- Parameters:
c
-- Returns:
- Throws:
E
-
containsAny
- Parameters:
a
-- Returns:
- Throws:
E
-
containsAny
- Parameters:
c
-- Returns:
- Throws:
E
-
hasDuplicates
- Returns:
- Throws:
E
-
kthLargest
- Parameters:
k
-comparator
-- Returns:
- Throws:
E
-
percentiles
@TerminalOp public u.Optional<Map<Percentage,T>> percentiles(Comparator<? super T> comparator) throws E - Parameters:
comparator
-- Returns:
- 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:
TooManyElementsException
- 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) - Type Parameters:
R
-E2
-- Parameters:
func
-- Returns:
- Throws:
E
E2
-
toSetAndThen
@TerminalOp public <R,E2 extends Exception> R toSetAndThen(Throwables.Function<? super Set<T>, R, throws E, E2E2> func) - Type Parameters:
R
-E2
-- Parameters:
func
-- Returns:
- Throws:
E
E2
-
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) - Type Parameters:
R
-CC
-E2
-- Parameters:
supplier
-func
-- Returns:
- Throws:
E
E2
-
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 typeE2
-E3
-- Parameters:
keyMapper
-valueMapper
-- Returns:
- Throws:
E
- the eE2
E3
IllegalStateException
- if there are duplicated keys.
-
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) - Type Parameters:
K
- the key typeV
- the value typeE2
-E3
-E4
-- Parameters:
keyMapper
-valueMapper
-mergeFunction
-- Returns:
- Throws:
E
- the eE2
E3
E4
-
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 typeE2
-E3
-- Parameters:
keyMapper
-valueMapper
-- Returns:
- Throws:
E
- the eE2
E3
IllegalStateException
- if there are duplicated keys.
-
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
-E2
-E3
-- Parameters:
keyMapper
-valueMapper
-mapFactory
-- Returns:
- Throws:
E
- the eE2
E3
IllegalStateException
- if there are duplicated keys.
-
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) - Type Parameters:
K
- the key typeV
- the value typeE2
-E3
-E4
-- Parameters:
keyMapper
-valueMapper
-mergeFunction
-- Returns:
- Throws:
E
- the eE2
E3
E4
-
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) - Type Parameters:
K
- the key typeV
- the value typeM
-E2
-E3
-E4
-- Parameters:
keyMapper
-valueMapper
-mergeFunction
-mapFactory
-- Returns:
- Throws:
E
- the eE2
E3
E4
-
groupTo
@TerminalOp public <K,E2 extends Exception> Map<K,List<T>> groupTo(Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper) - Type Parameters:
K
- the key typeE2
-- Parameters:
keyMapper
-- Returns:
- Throws:
E
- the eE2
- See Also:
-
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) - Type Parameters:
K
- the key typeM
-E2
-- Parameters:
keyMapper
-mapFactory
-- Returns:
- Throws:
E
- the eE2
- See Also:
-
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) - Type Parameters:
K
- the key typeV
- the value typeE2
-E3
-- Parameters:
keyMapper
-valueMapper
-- Returns:
- Throws:
E
- the eE2
E3
-
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) - Type Parameters:
K
- the key typeV
- the value typeM
-E2
-E3
-- Parameters:
keyMapper
-valueMapper
-mapFactory
-- Returns:
- Throws:
E
- the eE2
E3
- See Also:
-
groupTo
@TerminalOp public <K,D, Map<K,E2 extends Exception> D> groupTo(Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper, Collector<? super T, ?, D> downstream) - Type Parameters:
K
- the key typeD
-E2
-- Parameters:
keyMapper
-downstream
-- Returns:
- Throws:
E
- the eE2
-
groupTo
@TerminalOp public <K,D, M groupToM extends Map<K, D>, E2 extends Exception> (Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper, Collector<? super T, ?, D> downstream, Supplier<? extends M> mapFactory) - Type Parameters:
K
- the key typeD
-M
-E2
-- Parameters:
keyMapper
-downstream
-mapFactory
-- Returns:
- Throws:
E
- the eE2
-
groupTo
@TerminalOp public <K,V, Map<K,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, ?, D> downstream) - Type Parameters:
K
- the key typeV
- the value typeD
-E2
-E3
-- Parameters:
keyMapper
-valueMapper
-downstream
-- Returns:
- Throws:
E
- the eE2
E3
-
groupTo
@TerminalOp public <K,V, M groupToD, 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, ?, D> downstream, Supplier<? extends M> mapFactory) - Type Parameters:
K
- the key typeV
- the value typeD
-M
-E2
-E3
-- Parameters:
keyMapper
-valueMapper
-downstream
-mapFactory
-- Returns:
- Throws:
E
- the eE2
E3
-
partitionTo
@TerminalOp public <E2 extends Exception> Map<Boolean,List<T>> partitionTo(Throwables.Predicate<? super T, E2> predicate) throws E, E2- Type Parameters:
E2
-- Parameters:
predicate
-- Returns:
- Throws:
E
E2
- See Also:
-
partitionTo
@TerminalOp public <D,E2 extends Exception> Map<Boolean,D> partitionTo(Throwables.Predicate<? super T, E2> predicate, Collector<? super T, throws E, E2?, D> downstream) - Type Parameters:
D
-E2
-- Parameters:
predicate
-downstream
-- Returns:
- Throws:
E
E2
- See Also:
-
toMultimap
@TerminalOp public <K,E2 extends Exception> ListMultimap<K,T> toMultimap(Throwables.Function<? super T, ? extends K, throws E, E2E2> keyMapper) - Type Parameters:
K
-E2
-- Parameters:
keyMapper
-- Returns:
- Throws:
E
E2
-
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) - Type Parameters:
K
-V
-M
-E2
-- Parameters:
keyMapper
-mapFactory
-- Returns:
- Throws:
E
E2
-
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) - Type Parameters:
K
-V
-E2
-E3
-- Parameters:
keyMapper
-valueMapper
-- Returns:
- Throws:
E
E2
E3
-
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) - Type Parameters:
K
-V
-C
-M
-E2
-E3
-- Parameters:
keyMapper
-valueMapper
-mapFactory
-- Returns:
- Throws:
E
E2
E3
-
toMultiset
- Returns:
- Throws:
E
-
toMultiset
- Parameters:
supplier
-- Returns:
- Throws:
E
-
toLongMultiset
- Returns:
- Throws:
E
-
toLongMultiset
@TerminalOp public LongMultiset<T> toLongMultiset(Supplier<? extends LongMultiset<T>> supplier) throws E - Parameters:
supplier
-- Returns:
- 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 bean 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 bean or map.- Parameters:
columnNames
-- Returns:
- Throws:
E
-
sumInt
@TerminalOp public <E2 extends Exception> long sumInt(Throwables.ToIntFunction<? super T, E2> func) throws E, E2- Type Parameters:
E2
-- Parameters:
func
-- Returns:
- Throws:
E
- the eE2
-
sumLong
@TerminalOp public <E2 extends Exception> long sumLong(Throwables.ToLongFunction<? super T, E2> func) throws E, E2- Type Parameters:
E2
-- Parameters:
func
-- Returns:
- Throws:
E
- the eE2
-
sumDouble
@TerminalOp public <E2 extends Exception> double sumDouble(Throwables.ToDoubleFunction<? super T, E2> func) throws E, E2- Type Parameters:
E2
-- Parameters:
func
-- Returns:
- Throws:
E
- the eE2
-
averageInt
@TerminalOp public <E2 extends Exception> u.OptionalDouble averageInt(Throwables.ToIntFunction<? super T, E2> func) throws E, E2- Type Parameters:
E2
-- Parameters:
func
-- Returns:
- Throws:
E
- the eE2
-
averageLong
@TerminalOp public <E2 extends Exception> u.OptionalDouble averageLong(Throwables.ToLongFunction<? super T, E2> func) throws E, E2- Type Parameters:
E2
-- Parameters:
func
-- Returns:
- Throws:
E
- the eE2
-
averageDouble
@TerminalOp public <E2 extends Exception> u.OptionalDouble averageDouble(Throwables.ToDoubleFunction<? super T, E2> func) throws E, E2- Type Parameters:
E2
-- Parameters:
func
-- Returns:
- Throws:
E
- the eE2
-
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
-- Parameters:
collector
-- Returns:
- Throws:
E
- the e
-
collectAndThen
@TerminalOp public <R,RR, RR collectAndThenE2 extends Exception> (Collector<? super T, ?, throws E, E2R> collector, Throwables.Function<? super R, ? extends RR, E2> func) Collect and then.- Type Parameters:
R
-RR
-E2
-- Parameters:
collector
-func
-- Returns:
- Throws:
E
- the eE2
- the e2
-
join
- Parameters:
delimiter
-- Returns:
- Throws:
E
-
join
@TerminalOp public String join(CharSequence delimiter, CharSequence prefix, CharSequence suffix) throws E - Parameters:
delimiter
-prefix
-suffix
-- Returns:
- Throws:
E
-
saveEach
- Parameters:
output
-- Returns:
- See Also:
-
saveEach
@Beta @IntermediateOp public CheckedStream<T,E> saveEach(File output, Throwables.Function<? super T, String, E> toLine) - Parameters:
output
-toLine
-- Returns:
- See Also:
-
saveEach
@Beta @IntermediateOp public CheckedStream<T,E> saveEach(OutputStream output, Throwables.Function<? super T, String, E> toLine) - Parameters:
output
-toLine
-- Returns:
- See Also:
-
saveEach
@Beta @IntermediateOp public CheckedStream<T,E> saveEach(Writer output, Throwables.Function<? super T, String, E> toLine) - Parameters:
output
-toLine
-- Returns:
- See Also:
-
saveEach
@Beta @IntermediateOp public CheckedStream<T,E> saveEach(File output, Throwables.BiConsumer<? super T, Writer, IOException> writeLine) - Parameters:
output
-writeLine
-- Returns:
- See Also:
-
saveEach
@Beta @IntermediateOp public CheckedStream<T,E> saveEach(Writer output, Throwables.BiConsumer<? super T, Writer, IOException> writeLine) - Parameters:
output
-writeLine
-- Returns:
- See Also:
-
saveEach
@Beta @IntermediateOp public CheckedStream<T,E> saveEach(PreparedStatement stmt, Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) To support batch call, please useonEach
oronEachE
.- Parameters:
stmt
-stmtSetter
-- Returns:
- See Also:
-
saveEach
@Beta @IntermediateOp public CheckedStream<T,E> saveEach(Connection conn, String insertSQL, Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) To support batch call, please useonEach
oronEachE
.- Parameters:
conn
-insertSQL
-stmtSetter
-- Returns:
- See Also:
-
saveEach
@Beta @IntermediateOp public CheckedStream<T,E> saveEach(DataSource ds, String insertSQL, Throwables.BiConsumer<? super T, ? super PreparedStatement, SQLException> stmtSetter) To support batch/parallel call, please useonEach
oronEachE
.- Parameters:
ds
-insertSQL
-stmtSetter
-- Returns:
- See Also:
-
persist
- Parameters:
output
-- Returns:
- Throws:
E
IOException
-
persist
- Parameters:
output
-header
-tail
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(File output, Throwables.Function<? super T, String, throws E, IOExceptionE> toLine) - Parameters:
output
-toLine
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(File output, String header, String tail, Throwables.Function<? super T, String, throws E, IOExceptionE> toLine) - Parameters:
output
-header
-tail
-toLine
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(OutputStream output, Throwables.Function<? super T, String, throws E, IOExceptionE> toLine) - Parameters:
output
-toLine
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(OutputStream output, String header, String tail, Throwables.Function<? super T, String, throws E, IOExceptionE> toLine) - Parameters:
output
-header
-tail
-toLine
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(Writer output, Throwables.Function<? super T, String, throws E, IOExceptionE> toLine) - Parameters:
output
-toLine
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(Writer output, String header, String tail, Throwables.Function<? super T, String, throws E, IOExceptionE> toLine) - Parameters:
output
-header
-tail
-toLine
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(File output, Throwables.BiConsumer<? super T, Writer, throws E, IOExceptionIOException> writeLine) - Parameters:
output
-writeLine
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(File output, String header, String tail, Throwables.BiConsumer<? super T, Writer, throws E, IOExceptionIOException> writeLine) - Parameters:
output
-header
-tail
-writeLine
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(Writer output, Throwables.BiConsumer<? super T, Writer, throws E, IOExceptionIOException> writeLine) - Parameters:
output
-writeLine
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(Writer output, String header, String tail, Throwables.BiConsumer<? super T, Writer, throws E, IOExceptionIOException> writeLine) - Parameters:
output
-header
-tail
-writeLine
-- Returns:
- Throws:
E
IOException
-
persist
@TerminalOp public long persist(PreparedStatement stmt, int batchSize, long batchIntervalInMillis, Throwables.BiConsumer<? super T, ? super PreparedStatement, throws E, SQLExceptionSQLException> stmtSetter) - Parameters:
stmt
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
E
SQLException
-
persist
@TerminalOp public long persist(Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, Throwables.BiConsumer<? super T, ? super PreparedStatement, throws E, SQLExceptionSQLException> stmtSetter) - Parameters:
conn
-insertSQL
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
E
SQLException
-
persist
@TerminalOp public long persist(DataSource ds, String insertSQL, int batchSize, long batchIntervalInMillis, Throwables.BiConsumer<? super T, ? super PreparedStatement, throws E, SQLExceptionSQLException> stmtSetter) - Parameters:
ds
-insertSQL
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
E
SQLException
-
persistToCSV
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
output
-- Returns:
- Throws:
E
IOException
-
persistToCSV
@TerminalOp public long persistToCSV(File output, Collection<String> csvHeaders) throws E, IOException Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
output
-csvHeaders
-- Returns:
- Throws:
E
IOException
-
persistToCSV
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
output
-- Returns:
- Throws:
E
IOException
-
persistToCSV
@TerminalOp public long persistToCSV(OutputStream output, Collection<String> csvHeaders) throws E, IOException Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
output
-csvHeaders
-- Returns:
- Throws:
E
IOException
-
persistToCSV
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
output
-- Returns:
- Throws:
E
IOException
-
persistToCSV
@TerminalOp public long persistToCSV(Writer output, Collection<String> csvHeaders) throws E, IOException Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
output
-csvHeaders
-- Returns:
- Throws:
E
IOException
-
println
- Throws:
E
-
unchecked
- Returns:
-
toJdkStream
- Returns:
-
cast
- Returns:
-
transform
@Beta @IntermediateOp public <TT,EE extends Exception> CheckedStream<TT,EE> transform(Function<? super CheckedStream<T, E>, CheckedStream<TT, EE>> transfer) - Type Parameters:
TT
-EE
-- Parameters:
transfer
-- Returns:
-
__
@Beta @IntermediateOp @Deprecated public <TT,EE extends Exception> CheckedStream<TT,EE> __(Function<? super CheckedStream<T, E>, CheckedStream<TT, EE>> transfer) Deprecated.replaced bytransform(Function)
- Type Parameters:
TT
-EE
-- Parameters:
transfer
-- Returns:
-
sps
@Beta @IntermediateOp public <R> CheckedStream<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> CheckedStream<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 CheckedStream<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> CheckedStream<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> CheckedStream<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:
-
spsFlatmap
@Beta @IntermediateOp public <R> CheckedStream<R,E> spsFlatmap(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
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 CheckedStream<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.- Parameters:
maxThreadNum
-predicate
-- Returns:
- See Also:
-
spsMap
@Beta @IntermediateOp public <R> CheckedStream<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:
maxThreadNum
-mapper
-- Returns:
- See Also:
-
spsFlatMap
@Beta @IntermediateOp public <R> CheckedStream<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:
maxThreadNum
-mapper
-- Returns:
- See Also:
-
spsFlatmap
@Beta @IntermediateOp public <R> CheckedStream<R,E> spsFlatmap(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:
maxThreadNum
-mapper
-- Returns:
- See Also:
-
spsOnEach
@Beta @IntermediateOp public CheckedStream<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:
maxThreadNum
-action
-- Returns:
- See Also:
-
spsFilterE
@Beta @IntermediateOp public CheckedStream<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> CheckedStream<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:
U
-- Parameters:
mapper
-- Returns:
- See Also:
-
spsFlatMapE
@Beta @IntermediateOp public <R> CheckedStream<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:
-
spsFlatmapE
@Beta @IntermediateOp public <R> CheckedStream<R,Exception> spsFlatmapE(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 CheckedStream<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 CheckedStream<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> CheckedStream<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:
U
-- Parameters:
maxThreadNum
-mapper
-- Returns:
- See Also:
-
spsFlatMapE
@Beta @IntermediateOp public <R> CheckedStream<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:
-
spsFlatmapE
@Beta @IntermediateOp public <R> CheckedStream<R,Exception> spsFlatmapE(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 CheckedStream<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 CheckedStream<T,Exception> filterE(Throwables.Predicate<? super T, ? extends Exception> predicate) - Parameters:
predicate
-- Returns:
-
mapE
@Beta @IntermediateOp public <U> CheckedStream<U,Exception> mapE(Throwables.Function<? super T, ? extends U, ? extends Exception> mapper) - Type Parameters:
U
-- Parameters:
mapper
-- Returns:
-
flatMapE
@Beta @IntermediateOp public <R> CheckedStream<R,Exception> flatMapE(Throwables.Function<? super T, ? extends CheckedStream<? extends R, ? extends Exception>, ? extends Exception> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
flatmapE
@Beta @IntermediateOp public <R> CheckedStream<R,Exception> flatmapE(Throwables.Function<? super T, ? extends Collection<? extends R>, ? extends Exception> mapper) - Type Parameters:
R
-- Parameters:
mapper
-- Returns:
-
onEachE
@Beta @IntermediateOp public CheckedStream<T,Exception> onEachE(Throwables.Consumer<? super T, ? extends Exception> action) - Parameters:
action
-- Returns:
-
asyncRun
@Beta @TerminalOp public ContinuableFuture<Void> asyncRun(Throwables.Consumer<? super CheckedStream<T, E>, ? extends Exception> terminalAction) - Parameters:
terminalAction
- a terminal operation should be called.- Returns:
-
asyncRun
@Beta @TerminalOp public ContinuableFuture<Void> asyncRun(Throwables.Consumer<? super CheckedStream<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 CheckedStream<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 CheckedStream<T, E>, R, ? extends Exception> terminalAction, Executor executor) - Type Parameters:
R
-- Parameters:
terminalAction
- a terminal operation should be called.executor
-- Returns:
-
onClose
- Parameters:
closeHandler
-- Returns:
-
close
It will be called by terminal operations in final.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
transform(Function)