Interface Stream<T>
- All Superinterfaces:
AutoCloseable, BaseStream<T, Stream<T>>
A stream here is sequential and lazy: each stage pulls one element at a
time from the one before it, and only when a terminal operation asks. So
an infinite iterate or generate behind a limit ends, findFirst
and the anyMatch family stop at the element that decides them, and the
side effects of peek happen element by element, in encounter order.
What is not here: spliterators, and with them parallel evaluation.
parallel() answers the stream it was called on.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacejava.util.stream.Stream.Builder: collects elements, then answers them as a stream, once. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanstatic <T> Stream.Builder<T> builder()<R> Rcollect(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator, BiConsumer<R, R> combiner) <R,A> R static <T> Stream<T> longcount()distinct()static <T> Stream<T> empty()findAny()<R> Stream<R> flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) flatMapToInt(Function<? super T, ? extends IntStream> mapper) flatMapToLong(Function<? super T, ? extends LongStream> mapper) voidvoidforEachOrdered(Consumer<? super T> action) static <T> Stream<T> static <T> Stream<T> iterate(T seed, Predicate<? super T> hasNext, UnaryOperator<T> next) static <T> Stream<T> iterate(T seed, UnaryOperator<T> f) limit(long maxSize) <R> Stream<R> mapToDouble(ToDoubleFunction<? super T> mapper) mapToInt(ToIntFunction<? super T> mapper) mapToLong(ToLongFunction<? super T> mapper) max(Comparator<? super T> comparator) min(Comparator<? super T> comparator) booleanstatic <T> Stream<T> of(T t) static <T> Stream<T> of(T... values) static <T> Stream<T> ofNullable(T t) reduce(BinaryOperator<T> accumulator) reduce(T identity, BinaryOperator<T> accumulator) <U> Ureduce(U identity, BiFunction<U, ? super T, U> accumulator, BinaryOperator<U> combiner) skip(long n) sorted()sorted(Comparator<? super T> comparator) Object[]toArray()<A> A[]toArray(IntFunction<A[]> generator) toList()An unmodifiable list of the elements, which may be null.Methods inherited from interface BaseStream
close, isParallel, iterator, onClose, parallel, sequential, unordered
-
Method Details
-
filter
-
map
-
mapToInt
-
mapToLong
-
mapToDouble
-
flatMap
-
flatMapToInt
-
flatMapToLong
-
flatMapToDouble
-
distinct
-
sorted
-
sorted
-
peek
-
limit
-
skip
-
takeWhile
-
dropWhile
-
forEach
-
forEachOrdered
-
toArray
Object[] toArray() -
toArray
-
reduce
-
reduce
-
reduce
-
collect
-
collect
-
toList
-
min
-
max
-
count
long count() -
anyMatch
-
allMatch
-
noneMatch
-
findFirst
-
findAny
-
builder
-
empty
-
of
-
ofNullable
-
of
-
iterate
-
iterate
-
generate
-
concat
-