18.5 Creating a Stream
The java.util.stream package declares various types related to streams. At the center is a generically declared Stream interface for object streams. A copy is always generated from a data source. Numerous stream generators are available.
|
Type |
Method |
Return |
|---|---|---|
|
Collection<E> |
stream() |
Stream<E> |
|
Arrays |
stream(T[] array) (static) |
Stream<T> |
|
stream(T[] array, int start, int end) (static) |
Stream<T> |
|
|
Stream |
empty() (static) |
Stream<T> |
|
of(T… values) (static) |
Stream<T> |
|
|
of(T value) (static) |
Stream<T> |
|
|
generate(Supplier<T> s) (static) |
Stream<T> |
|
|
iterate(T seed, UnaryOperator<T> f) (static) |
Stream<T> |
|
|
iterate(T seed, Predicate<? super ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access