Uses of Interface
java.util.stream.Stream
-
Packages that use Stream Package Description java.io Provides for system input and output through data streams, serialization and the file system.java.nio.file Defines interfaces and classes for the Java virtual machine to access files, file attributes, and file systems.java.util Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).java.util.jar Provides classes for reading and writing the JAR (Java ARchive) file format, which is based on the standard ZIP file format with an optional manifest file.java.util.regex Classes for matching character sequences against patterns specified by regular expressions.java.util.stream Classes to support functional-style operations on streams of elements, such as map-reduce transformations on collections.java.util.zip Provides classes for reading and writing the standard ZIP and GZIP file formats. -
-
Uses of Stream in java.io
Methods in java.io that return Stream Modifier and Type Method and Description Stream<String>
BufferedReader. lines()
Returns aStream
, the elements of which are lines read from thisBufferedReader
. -
Uses of Stream in java.nio.file
Methods in java.nio.file that return Stream Modifier and Type Method and Description static Stream<Path>
Files. find(Path start, int maxDepth, BiPredicate<Path,BasicFileAttributes> matcher, FileVisitOption... options)
Return aStream
that is lazily populated withPath
by searching for files in a file tree rooted at a given starting file.static Stream<String>
Files. lines(Path path)
Read all lines from a file as aStream
.static Stream<String>
Files. lines(Path path, Charset cs)
Read all lines from a file as aStream
.static Stream<Path>
Files. list(Path dir)
Return a lazily populatedStream
, the elements of which are the entries in the directory.static Stream<Path>
Files. walk(Path start, FileVisitOption... options)
Return aStream
that is lazily populated withPath
by walking the file tree rooted at a given starting file.static Stream<Path>
Files. walk(Path start, int maxDepth, FileVisitOption... options)
Return aStream
that is lazily populated withPath
by walking the file tree rooted at a given starting file. -
Uses of Stream in java.util
Methods in java.util that return Stream Modifier and Type Method and Description default Stream<E>
Collection. parallelStream()
Returns a possibly parallelStream
with this collection as its source.default Stream<E>
Collection. stream()
Returns a sequentialStream
with this collection as its source.static <T> Stream<T>
Arrays. stream(T[] array)
Returns a sequentialStream
with the specified array as its source.static <T> Stream<T>
Arrays. stream(T[] array, int startInclusive, int endExclusive)
Returns a sequentialStream
with the specified range of the specified array as its source. -
Uses of Stream in java.util.jar
Methods in java.util.jar that return Stream Modifier and Type Method and Description Stream<JarEntry>
JarFile. stream()
-
Uses of Stream in java.util.regex
Methods in java.util.regex that return Stream Modifier and Type Method and Description Stream<String>
Pattern. splitAsStream(CharSequence input)
Creates a stream from the given input sequence around matches of this pattern. -
Uses of Stream in java.util.stream
Methods in java.util.stream that return Stream Modifier and Type Method and Description Stream<Double>
DoubleStream. boxed()
Returns aStream
consisting of the elements of this stream, boxed toDouble
.Stream<Long>
LongStream. boxed()
Returns aStream
consisting of the elements of this stream, each boxed to aLong
.Stream<Integer>
IntStream. boxed()
Returns aStream
consisting of the elements of this stream, each boxed to anInteger
.Stream<T>
Stream.Builder. build()
Builds the stream, transitioning this builder to the built state.static <T> Stream<T>
Stream. concat(Stream<? extends T> a, Stream<? extends T> b)
Creates a lazily concatenated stream whose elements are all the elements of the first stream followed by all the elements of the second stream.Stream<T>
Stream. distinct()
Returns a stream consisting of the distinct elements (according toObject.equals(Object)
) of this stream.static <T> Stream<T>
Stream. empty()
Returns an empty sequentialStream
.Stream<T>
Stream. filter(Predicate<? super T> predicate)
Returns a stream consisting of the elements of this stream that match the given predicate.<R> Stream<R>
Stream. flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.static <T> Stream<T>
Stream. generate(Supplier<T> s)
Returns an infinite sequential unordered stream where each element is generated by the providedSupplier
.static <T> Stream<T>
Stream. iterate(T seed, UnaryOperator<T> f)
Returns an infinite sequential orderedStream
produced by iterative application of a functionf
to an initial elementseed
, producing aStream
consisting ofseed
,f(seed)
,f(f(seed))
, etc.Stream<T>
Stream. limit(long maxSize)
Returns a stream consisting of the elements of this stream, truncated to be no longer thanmaxSize
in length.<R> Stream<R>
Stream. map(Function<? super T,? extends R> mapper)
Returns a stream consisting of the results of applying the given function to the elements of this stream.<U> Stream<U>
DoubleStream. mapToObj(DoubleFunction<? extends U> mapper)
Returns an object-valuedStream
consisting of the results of applying the given function to the elements of this stream.<U> Stream<U>
IntStream. mapToObj(IntFunction<? extends U> mapper)
Returns an object-valuedStream
consisting of the results of applying the given function to the elements of this stream.<U> Stream<U>
LongStream. mapToObj(LongFunction<? extends U> mapper)
Returns an object-valuedStream
consisting of the results of applying the given function to the elements of this stream.static <T> Stream<T>
Stream. of(T... values)
Returns a sequential ordered stream whose elements are the specified values.static <T> Stream<T>
Stream. of(T t)
Returns a sequentialStream
containing a single element.Stream<T>
Stream. peek(Consumer<? super T> action)
Returns a stream consisting of the elements of this stream, additionally performing the provided action on each element as elements are consumed from the resulting stream.Stream<T>
Stream. skip(long n)
Returns a stream consisting of the remaining elements of this stream after discarding the firstn
elements of the stream.Stream<T>
Stream. sorted()
Returns a stream consisting of the elements of this stream, sorted according to natural order.Stream<T>
Stream. sorted(Comparator<? super T> comparator)
Returns a stream consisting of the elements of this stream, sorted according to the providedComparator
.static <T> Stream<T>
StreamSupport. stream(Spliterator<T> spliterator, boolean parallel)
Creates a new sequential or parallelStream
from aSpliterator
.static <T> Stream<T>
StreamSupport. stream(Supplier<? extends Spliterator<T>> supplier, int characteristics, boolean parallel)
Creates a new sequential or parallelStream
from aSupplier
ofSpliterator
.Methods in java.util.stream with parameters of type Stream Modifier and Type Method and Description static <T> Stream<T>
Stream. concat(Stream<? extends T> a, Stream<? extends T> b)
Creates a lazily concatenated stream whose elements are all the elements of the first stream followed by all the elements of the second stream.static <T> Stream<T>
Stream. concat(Stream<? extends T> a, Stream<? extends T> b)
Creates a lazily concatenated stream whose elements are all the elements of the first stream followed by all the elements of the second stream.Method parameters in java.util.stream with type arguments of type Stream Modifier and Type Method and Description <R> Stream<R>
Stream. flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element. -
Uses of Stream in java.util.zip
Methods in java.util.zip that return Stream Modifier and Type Method and Description Stream<? extends ZipEntry>
ZipFile. stream()
Return an orderedStream
over the ZIP file entries.
-
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.