Skip to content

Commit b5fc8df

Browse files
committed
Published with https://stackedit.io/
1 parent fb18608 commit b5fc8df

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

29.Java8之Stream.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,11 @@ Stream类和集合类都用于操作集合,但是Stream跟集合类存在很
4040
* df
4141
*
4242

43+
No storage. A stream is not a data structure that stores elements; instead, it conveys elements from a source such as a data structure, an array, a generator function, or an I/O channel, through a pipeline of computational operations.
44+
Functional in nature. An operation on a stream produces a result, but does not modify its source. For example, filtering a Stream obtained from a collection produces a new Stream without the filtered elements, rather than removing elements from the source collection.
45+
Laziness-seeking. Many stream operations, such as filtering, mapping, or duplicate removal, can be implemented lazily, exposing opportunities for optimization. For example, "find the first String with three consecutive vowels" need not examine all the input strings. Stream operations are divided into intermediate (Stream-producing) operations and terminal (value- or side-effect-producing) operations. Intermediate operations are always lazy.
46+
Possibly unbounded. While collections have a finite size, streams need not. Short-circuiting operations such as limit(n) or findFirst() can allow computations on infinite streams to complete in finite time.
47+
Consumable. The elements of a stream are only visited once during the life of a stream. Like an Iterator, a new stream must be generated to revisit the same elements of the source.
48+
49+
4350
Classes to support functional-style operations on streams of elements, such as map-reduce transformations on collections.

0 commit comments

Comments
 (0)