com.landawn.abacus.util.stream.Stream Maven / Gradle / Ivy
Show all versions of abacus-common Show documentation
/*
* Copyright (C) 2016, 2017, 2018, 2019 HaiYang Li
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.landawn.abacus.util.stream;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.security.SecureRandom;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Deque;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.BiPredicate;
import java.util.function.BinaryOperator;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.DoubleConsumer;
import java.util.function.Function;
import java.util.function.IntConsumer;
import java.util.function.IntFunction;
import java.util.function.LongConsumer;
import java.util.function.LongFunction;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.function.ToDoubleFunction;
import java.util.function.ToIntFunction;
import java.util.function.ToLongFunction;
import java.util.function.UnaryOperator;
import java.util.stream.Collector;
import com.landawn.abacus.annotation.Beta;
import com.landawn.abacus.annotation.IntermediateOp;
import com.landawn.abacus.annotation.LazyEvaluation;
import com.landawn.abacus.annotation.ParallelSupported;
import com.landawn.abacus.annotation.SequentialOnly;
import com.landawn.abacus.annotation.TerminalOp;
import com.landawn.abacus.annotation.TerminalOpTriggered;
import com.landawn.abacus.exception.UncheckedIOException;
import com.landawn.abacus.util.Array;
import com.landawn.abacus.util.AsyncExecutor;
import com.landawn.abacus.util.ByteIterator;
import com.landawn.abacus.util.CharIterator;
import com.landawn.abacus.util.Charsets;
import com.landawn.abacus.util.ClassUtil;
import com.landawn.abacus.util.ContinuableFuture;
import com.landawn.abacus.util.DataSet;
import com.landawn.abacus.util.DoubleIterator;
import com.landawn.abacus.util.Duration;
import com.landawn.abacus.util.ExceptionalStream;
import com.landawn.abacus.util.ExceptionalStream.CheckedStream;
import com.landawn.abacus.util.FloatIterator;
import com.landawn.abacus.util.Fn;
import com.landawn.abacus.util.Fn.Fnn;
import com.landawn.abacus.util.Fn.Suppliers;
import com.landawn.abacus.util.Holder;
import com.landawn.abacus.util.IOUtil;
import com.landawn.abacus.util.ImmutableMap;
import com.landawn.abacus.util.Indexed;
import com.landawn.abacus.util.IntIterator;
import com.landawn.abacus.util.Iterators;
import com.landawn.abacus.util.Joiner;
import com.landawn.abacus.util.Keyed;
import com.landawn.abacus.util.LineIterator;
import com.landawn.abacus.util.ListMultimap;
import com.landawn.abacus.util.LongIterator;
import com.landawn.abacus.util.MergeResult;
import com.landawn.abacus.util.Multimap;
import com.landawn.abacus.util.MutableBoolean;
import com.landawn.abacus.util.MutableInt;
import com.landawn.abacus.util.MutableLong;
import com.landawn.abacus.util.N;
import com.landawn.abacus.util.NoCachingNoUpdating;
import com.landawn.abacus.util.NoCachingNoUpdating.DisposableEntry;
import com.landawn.abacus.util.ObjIterator;
import com.landawn.abacus.util.Pair;
import com.landawn.abacus.util.Percentage;
import com.landawn.abacus.util.RateLimiter;
import com.landawn.abacus.util.ShortIterator;
import com.landawn.abacus.util.Splitter;
import com.landawn.abacus.util.Throwables;
import com.landawn.abacus.util.u.Optional;
import com.landawn.abacus.util.u.OptionalDouble;
import com.landawn.abacus.util.u.OptionalInt;
import com.landawn.abacus.util.u.OptionalLong;
import com.landawn.abacus.util.function.ByteBiFunction;
import com.landawn.abacus.util.function.ByteNFunction;
import com.landawn.abacus.util.function.ByteTriFunction;
import com.landawn.abacus.util.function.CharBiFunction;
import com.landawn.abacus.util.function.CharNFunction;
import com.landawn.abacus.util.function.CharTriFunction;
import com.landawn.abacus.util.function.DoubleBiFunction;
import com.landawn.abacus.util.function.DoubleNFunction;
import com.landawn.abacus.util.function.DoubleTriFunction;
import com.landawn.abacus.util.function.FloatBiFunction;
import com.landawn.abacus.util.function.FloatNFunction;
import com.landawn.abacus.util.function.FloatTriFunction;
import com.landawn.abacus.util.function.IntBiFunction;
import com.landawn.abacus.util.function.IntNFunction;
import com.landawn.abacus.util.function.IntTriFunction;
import com.landawn.abacus.util.function.LongBiFunction;
import com.landawn.abacus.util.function.LongNFunction;
import com.landawn.abacus.util.function.LongTriFunction;
import com.landawn.abacus.util.function.ShortBiFunction;
import com.landawn.abacus.util.function.ShortNFunction;
import com.landawn.abacus.util.function.ShortTriFunction;
import com.landawn.abacus.util.function.ToByteFunction;
import com.landawn.abacus.util.function.ToCharFunction;
import com.landawn.abacus.util.function.ToFloatFunction;
import com.landawn.abacus.util.function.ToShortFunction;
import com.landawn.abacus.util.function.TriFunction;
import com.landawn.abacus.util.function.TriPredicate;
import com.landawn.abacus.util.stream.ObjIteratorEx.BufferedIterator;
/**
* Note: This class includes codes copied from StreamEx: https://github.com/amaembo/streamex under Apache License, version 2.0.
*
*
* The Stream will be automatically closed after execution(A terminal method is executed/triggered).
*
* @param the type of the stream elements
* @see BaseStream
* @see IntStream
* @see LongStream
* @see DoubleStream
* @see EntryStream
* @see com.landawn.abacus.util.ExceptionalStream
* @see Collectors
* @see com.landawn.abacus.util.Fn
* @see com.landawn.abacus.util.Comparators
*/
@com.landawn.abacus.annotation.Immutable
@LazyEvaluation
@SuppressWarnings({ "java:S1192", "java:S1845" })
public abstract class Stream
extends StreamBase, Consumer, List, Optional, Indexed, ObjIterator, Stream> {
static final Random RAND = new SecureRandom();
Stream(final boolean sorted, final Comparator cmp, final Collection closeHandlers) {
super(sorted, cmp, closeHandlers);
}
/**
* Select the elements belong to the specified {@code targetType}(including its subtype).
*
* @param
* @param targetType
* @return
*/
@SequentialOnly
@IntermediateOp
public Stream select(final Class targetType) {
if (isParallel()) {
return (Stream) sequential().filter(Fn.instanceOf(targetType))
.parallel(maxThreadNum(), executorNumForVirtualThread(), splitor(), asyncExecutor(), cancelUncompletedThreads());
} else {
return (Stream) filter(Fn.instanceOf(targetType));
}
}
/**
*
* @param predicate
* @return
*/
@SequentialOnly
@Beta
@IntermediateOp
@Override
public Stream skipUntil(final Predicate predicate) {
return dropWhile(Fn.not(predicate));
}
/**
*
*
* @param
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream map(Function mapper);
/**
*
*
* @param
* @param extractor
* @return
*/
@ParallelSupported
@IntermediateOp
public Stream> pairWith(final Function extractor) {
return map(t -> Pair.of(t, extractor.apply(t)));
}
// public abstract Stream biMap(BiFunction mapper);
//
// /**
// * Returns a stream consisting of the results of applying the given function
// * to the every two adjacent elements of this stream.
// *
// *
// *
// * Stream.of("a", "b", "c", "d", "e").biMap((i, j) -> i + "-" + j).println();
// * // print out: [a-b, c-d, e-null]
// *
// *
// *
// * @param mapper
// * @param ignoreNotPaired flag to identify if need to ignore the last element when the total length of the stream is odd number. Default value is false
// * @return
// */
// public abstract Stream biMap(BiFunction mapper, boolean ignoreNotPaired);
//
// public abstract Stream triMap(TriFunction mapper);
//
// /**
// * Returns a stream consisting of the results of applying the given function
// * to the every three adjacent elements of this stream.
// *
// *
// *
// * Stream.of("a", "b", "c", "d", "e").triMap((i, j, k) -> i + "-" + j + "-" + k).println();
// * // print out: [a-b-c, d-e-null]
// *
// *
// *
// * @param mapper
// * @param ignoreNotPaired flag to identify if need to ignore the last one or two elements when the total length of the stream is not multiple of 3. Default value is false
// * @return
// */
// public abstract Stream triMap(TriFunction mapper, boolean ignoreNotPaired);
/**
*
*
* @param
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream slidingMap(BiFunction mapper);
/**
* Slide with windowSize = 2
and the specified increment
, then map
by the specified mapper
.
*
* @param
* @param mapper
* @param increment
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream slidingMap(BiFunction mapper, int increment);
/**
*
*
* @param
* @param mapper
* @param increment
* @param ignoreNotPaired
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream slidingMap(BiFunction mapper, int increment, boolean ignoreNotPaired);
/**
*
*
* @param
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream slidingMap(TriFunction mapper);
/**
* Slide with windowSize = 3
and the specified increment
, then map
by the specified mapper
.
*
* @param
* @param mapper
* @param increment
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream slidingMap(TriFunction mapper, int increment);
/**
*
*
* @param
* @param mapper
* @param increment
* @param ignoreNotPaired
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream slidingMap(TriFunction mapper, int increment, boolean ignoreNotPaired);
/**
* Note: copied from StreamEx: https://github.com/amaembo/streamex
*
*
*
* Returns a stream consisting of results of applying the given function to
* the ranges created from the source elements.
*
*
*
* Stream.of("a", "ab", "ac", "b", "c", "cb").rangeMap((a, b) -> b.startsWith(a), (a, b) -> a + "->" + b).toList(); // a->ac, b->b, c->cb
*
*
*
*
* This is a quasi-intermediate
* partial reduction operation.
*
* @param the type of the resulting elements
* @param sameRange a non-interfering, stateless predicate to apply to
* the leftmost and next elements which returns true for elements
* which belong to the same range.
* @param mapper a non-interfering, stateless function to apply to the
* range borders and produce the resulting element. If value was
* not merged to the interval, then mapper will receive the same
* value twice, otherwise it will receive the leftmost and the
* rightmost values which were merged to the range.
* @return
* @see #collapse(BiPredicate, BinaryOperator)
*/
@SequentialOnly
@IntermediateOp
public abstract Stream rangeMap(final BiPredicate sameRange, final BiFunction mapper);
/**
*
*
* @param mapperForFirst
* @return
*/
@SequentialOnly
@IntermediateOp
public abstract Stream mapFirst(Function mapperForFirst);
/**
*
*
* @param
* @param mapperForFirst
* @param mapperForElse
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream mapFirstOrElse(Function mapperForFirst, Function mapperForElse);
/**
*
*
* @param mapperForLast
* @return
*/
@SequentialOnly
@IntermediateOp
public abstract Stream mapLast(Function mapperForLast);
/**
*
*
* @param
* @param mapperForLast
* @param mapperForElse
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream mapLastOrElse(Function mapperForLast, Function mapperForElse);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract CharStream mapToChar(ToCharFunction mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract ByteStream mapToByte(ToByteFunction mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract ShortStream mapToShort(ToShortFunction mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract IntStream mapToInt(ToIntFunction mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract LongStream mapToLong(ToLongFunction mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract FloatStream mapToFloat(ToFloatFunction mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract DoubleStream mapToDouble(ToDoubleFunction mapper);
// public abstract EntryStream mapToEntry();
/**
*
*
* @param
* @param
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract EntryStream mapToEntry(Function> mapper);
/**
*
*
* @param
* @param
* @param keyMapper
* @param valueMapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract EntryStream mapToEntry(Function keyMapper, Function valueMapper);
// public abstract Stream mapp(Function> mapper);
/**
*
*
* @param
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream flatMap(Function> mapper);
/**
*
*
* @param
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream flatmap(Function> mapper);
/**
*
*
* @param
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract Stream flattMap(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract CharStream flatMapToChar(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract CharStream flatmapToChar(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract ByteStream flatMapToByte(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract ByteStream flatmapToByte(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract ShortStream flatMapToShort(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract ShortStream flatmapToShort(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract IntStream flatMapToInt(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract IntStream flatmapToInt(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract LongStream flatMapToLong(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract LongStream flatmapToLong(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract FloatStream flatMapToFloat(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract FloatStream flatmapToFloat(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract DoubleStream flatMapToDouble(Function mapper);
/**
*
*
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract DoubleStream flatmapToDouble(Function mapper);
/**
*
*
* @param
* @param
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract EntryStream flatMapToEntry(Function>> mapper);
/**
*
*
* @param
* @param
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract EntryStream flatmapToEntry(Function> mapper);
/**
*
*
* @param
* @param
* @param mapper
* @return
*/
@ParallelSupported
@IntermediateOp
public abstract EntryStream flattMapToEntry(Function> mapper); //NOSONAR
/**
*
*
* @param
* @param mapper
* @return
* @implNote same as ====>
*
* skipNulls().flatmap(mapper)
*
*/
@Beta
@ParallelSupported
@IntermediateOp
public Stream flatMapIfNotNull(Function> mapper) {
return skipNulls().flatmap(mapper);
}
/**
*
*
* @param
* @param
* @param mapper
* @param mapper2
* @return
* @implNote same as ====>
*
* skipNulls().flatmap(mapper).skipNulls().flatmap(mapper2)
*
*/
@Beta
@ParallelSupported
@IntermediateOp
public Stream flatMapIfNotNull(Function> mapper,
Function> mapper2) {
return skipNulls().flatmap(mapper).skipNulls().flatmap(mapper2);
}
/**
*
*
* @param
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract Stream mapMulti(BiConsumer> mapper);
/**
*
*
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract IntStream mapMultiToInt(BiConsumer mapper);
/**
*
*
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract LongStream mapMultiToLong(BiConsumer mapper);
/**
*
*
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract DoubleStream mapMultiToDouble(BiConsumer mapper);
/**
* Note: copied from StreamEx: https://github.com/amaembo/streamex
*
* @param
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract Stream mapPartial(Function> mapper);
/**
* Note: copied from StreamEx: https://github.com/amaembo/streamex
*
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract IntStream mapPartialToInt(Function mapper);
/**
* Note: copied from StreamEx: https://github.com/amaembo/streamex
*
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract LongStream mapPartialToLong(Function mapper);
/**
* Note: copied from StreamEx: https://github.com/amaembo/streamex
*
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract DoubleStream mapPartialToDouble(Function mapper);
/**
* Note: copied from StreamEx: https://github.com/amaembo/streamex
*
* @param
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract Stream mapPartialJdk(Function> mapper);
/**
* Note: copied from StreamEx: https://github.com/amaembo/streamex
*
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract IntStream mapPartialToIntJdk(Function mapper);
/**
* Note: copied from StreamEx: https://github.com/amaembo/streamex
*
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract LongStream mapPartialToLongJdk(Function mapper);
/**
* Note: copied from StreamEx: https://github.com/amaembo/streamex
*
* @param mapper
* @return
*/
@Beta
@ParallelSupported
@IntermediateOp
public abstract DoubleStream mapPartialToDoubleJdk(Function mapper);
/**
*
*
* @param
* @param keyMapper
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream>> groupBy(final Function keyMapper);
/**
*
*
* @param
* @param keyMapper
* @param mapFactory
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream>> groupBy(final Function keyMapper,
final Supplier>> mapFactory);
/**
*
*
* @param
* @param
* @param keyMapper
* @param valueMapper
* @return
* @see Collectors#toMultimap(Function, Function)
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream>> groupBy(Function keyMapper, Function valueMapper);
/**
*
*
* @param
* @param
* @param keyMapper
* @param valueMapper
* @param mapFactory
* @return
* @see Collectors#toMultimap(Function, Function, Supplier)
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream>> groupBy(Function keyMapper, Function valueMapper,
Supplier>> mapFactory);
/**
*
*
* @param
* @param
* @param
* @param keyMapper
* @param downstream
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream> groupBy(final Function keyMapper, final Collector downstream);
/**
*
*
* @param
* @param
* @param
* @param keyMapper
* @param downstream
* @param mapFactory
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream> groupBy(final Function keyMapper, final Collector downstream,
final Supplier> mapFactory);
/**
*
*
* @param
* @param
* @param
* @param
* @param keyMapper
* @param valueMapper
* @param downstream
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream> groupBy(final Function keyMapper,
final Function valueMapper, final Collector downstream);
/**
*
* @param
* @param
* @param // TODO do we need A
* @param
* @param keyMapper
* @param valueMapper
* @param downstream
* @param mapFactory
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream> groupBy(final Function keyMapper,
final Function valueMapper, final Collector downstream, final Supplier> mapFactory);
/**
*
*
* @param
* @param
* @param keyMapper
* @param valueMapper
* @param mergeFunction
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream> groupBy(final Function keyMapper, final Function valueMapper,
BinaryOperator mergeFunction);
/**
*
*
* @param
* @param
* @param keyMapper
* @param valueMapper
* @param mergeFunction
* @param mapFactory
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream> groupBy(final Function keyMapper, final Function valueMapper,
final BinaryOperator mergeFunction, final Supplier> mapFactory);
// @ParallelSupported
// public abstract Stream>> flatGroupBy(final Throwables.Function, E> flatKeyMapper);
//
// @ParallelSupported
// public abstract Stream>> flatGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Supplier>> mapFactory);
//
// /**
// *
// * @param flatKeyMapper
// * @param valueMapper
// * @return
// * @see Collectors#toMultimap(Function, Function)
// */
// @ParallelSupported
// public abstract Stream>> flatGroupBy(Throwables.Function, E> flatKeyMapper,
// Throwables.BiFunction valueMapper);
//
// /**
// *
// * @param flatKeyMapper
// * @param valueMapper
// * @param mapFactory
// * @return
// * @see Collectors#toMultimap(Function, Function, Supplier)
// */
// @ParallelSupported
// public abstract Stream>> flatGroupBy(Throwables.Function, E> flatKeyMapper,
// Throwables.BiFunction valueMapper, Supplier>> mapFactory);
//
// @ParallelSupported
// public abstract Stream> flatGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Collector downstream);
//
// @ParallelSupported
// public abstract Stream> flatGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Collector downstream, final Supplier> mapFactory);
//
// @ParallelSupported
// public abstract Stream> flatGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Throwables.BiFunction valueMapper, final Collector downstream);
//
// @ParallelSupported
// public abstract Stream> flatGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Throwables.BiFunction valueMapper, final Collector downstream,
// final Supplier> mapFactory);
//
// @ParallelSupported
// public abstract Stream> flatGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Throwables.BiFunction valueMapper, BinaryOperator mergeFunction);
//
// @ParallelSupported
// public abstract Stream> flatGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Throwables.BiFunction valueMapper, final BinaryOperator mergeFunction,
// final Supplier> mapFactory);
//
// @ParallelSupported
// public abstract Stream>> flattGroupBy(final Throwables.Function, E> flatKeyMapper);
//
// @ParallelSupported
// public abstract Stream>> flattGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Supplier>> mapFactory);
//
// /**
// *
// * @param flatKeyMapper
// * @param valueMapper
// * @return
// * @see Collectors#toMultimap(Function, Function)
// */
// @ParallelSupported
// public abstract Stream>> flattGroupBy(Throwables.Function, E> flatKeyMapper,
// Throwables.BiFunction valueMapper);
//
// /**
// *
// * @param flatKeyMapper
// * @param valueMapper
// * @param mapFactory
// * @return
// * @see Collectors#toMultimap(Function, Function, Supplier)
// */
// @ParallelSupported
// public abstract Stream>> flattGroupBy(Throwables.Function, E> flatKeyMapper,
// Throwables.BiFunction valueMapper, Supplier>> mapFactory);
//
// @ParallelSupported
// public abstract Stream> flattGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Collector downstream);
//
// @ParallelSupported
// public abstract Stream> flattGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Collector downstream, final Supplier> mapFactory);
//
// @ParallelSupported
// public abstract Stream> flattGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Throwables.BiFunction valueMapper, final Collector downstream);
//
// @ParallelSupported
// public abstract Stream> flattGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Throwables.BiFunction valueMapper, final Collector downstream,
// final Supplier> mapFactory);
//
// @ParallelSupported
// public abstract Stream> flattGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Throwables.BiFunction valueMapper, BinaryOperator mergeFunction);
//
// @ParallelSupported
// public abstract Stream> flattGroupBy(final Throwables.Function, E> flatKeyMapper,
// final Throwables.BiFunction valueMapper, final BinaryOperator mergeFunction,
// final Supplier> mapFactory);
/**
*
*
* @param
* @param keyMapper
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract EntryStream> groupByToEntry(final Function keyMapper);
/**
*
*
* @param
* @param keyMapper
* @param mapFactory
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract EntryStream> groupByToEntry(final Function keyMapper,
final Supplier>> mapFactory);
/**
*
*
* @param
* @param
* @param keyMapper
* @param valueMapper
* @return
* @see Collectors#toMultimap(Function, Function)
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract EntryStream> groupByToEntry(Function keyMapper, Function valueMapper);
/**
*
*
* @param
* @param
* @param keyMapper
* @param valueMapper
* @param mapFactory
* @return
* @see Collectors#toMultimap(Function, Function, Supplier)
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract EntryStream> groupByToEntry(Function keyMapper, Function valueMapper,
Supplier>> mapFactory);
/**
*
*
* @param
* @param
* @param
* @param keyMapper
* @param downstream
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract EntryStream groupByToEntry(final Function keyMapper, final Collector downstream);
/**
*
*
* @param
* @param
* @param
* @param keyMapper
* @param downstream
* @param mapFactory
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract EntryStream groupByToEntry(final Function keyMapper, final Collector downstream,
final Supplier> mapFactory);
/**
*
*
* @param
* @param
* @param
* @param
* @param keyMapper
* @param valueMapper
* @param downstream
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract EntryStream groupByToEntry(final Function keyMapper,
final Function valueMapper, final Collector downstream);
/**
*
*
* @param
* @param
* @param
* @param
* @param keyMapper
* @param valueMapper
* @param downstream
* @param mapFactory
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract EntryStream groupByToEntry(final Function keyMapper,
final Function valueMapper, final Collector downstream, final Supplier> mapFactory);
/**
*
*
* @param
* @param
* @param keyMapper
* @param valueMapper
* @param mergeFunction
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract EntryStream groupByToEntry(final Function keyMapper,
final Function valueMapper, BinaryOperator mergeFunction);
/**
*
*
* @param
* @param
* @param keyMapper
* @param valueMapper
* @param mergeFunction
* @param mapFactory
* @return
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract EntryStream groupByToEntry(final Function keyMapper,
final Function valueMapper, final BinaryOperator mergeFunction, final Supplier> mapFactory);
/**
*
* @param predicate
* @return
* @see Collectors#partitioningBy(Predicate)
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream>> partitionBy(final Predicate predicate);
/**
*
*
* @param
* @param
* @param predicate
* @param downstream
* @return
* @see Collectors#partitioningBy(Predicate, Collector)
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract Stream> partitionBy(final Predicate predicate, final Collector downstream);
/**
*
* @param predicate
* @return
* @see Collectors#partitioningBy(Predicate)
*/
@ParallelSupported
@IntermediateOp
@TerminalOpTriggered
public abstract EntryStream> partitionByToEntry(final Predicate predicate);
/**
*
*
* @param
* @param