mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8238919: (doc) Broken code snippet in the java.util.stream package documentation
Reviewed-by: mchung, naoto
This commit is contained in:
parent
93241e5db7
commit
eccdd8e603
1 changed files with 4 additions and 4 deletions
|
@ -43,7 +43,7 @@
|
||||||
* <p>The key abstraction introduced in this package is <em>stream</em>. The
|
* <p>The key abstraction introduced in this package is <em>stream</em>. The
|
||||||
* classes {@link java.util.stream.Stream}, {@link java.util.stream.IntStream},
|
* classes {@link java.util.stream.Stream}, {@link java.util.stream.IntStream},
|
||||||
* {@link java.util.stream.LongStream}, and {@link java.util.stream.DoubleStream}
|
* {@link java.util.stream.LongStream}, and {@link java.util.stream.DoubleStream}
|
||||||
* are streams over objects and the primitive {@code int}, {@code long} and
|
* are streams over objects and the primitive {@code int}, {@code long}, and
|
||||||
* {@code double} types. Streams differ from collections in several ways:
|
* {@code double} types. Streams differ from collections in several ways:
|
||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
|
@ -176,7 +176,7 @@
|
||||||
* do:
|
* do:
|
||||||
*
|
*
|
||||||
* <pre>{@code
|
* <pre>{@code
|
||||||
* int sumOfWeights = widgets.<b>parallelStream()</b>
|
* int sumOfWeights = widgets.parallelStream()
|
||||||
* .filter(b -> b.getColor() == RED)
|
* .filter(b -> b.getColor() == RED)
|
||||||
* .mapToInt(b -> b.getWeight())
|
* .mapToInt(b -> b.getWeight())
|
||||||
* .sum();
|
* .sum();
|
||||||
|
@ -242,7 +242,7 @@
|
||||||
* String s = sl.collect(joining(" "));
|
* String s = sl.collect(joining(" "));
|
||||||
* }</pre>
|
* }</pre>
|
||||||
*
|
*
|
||||||
* First a list is created consisting of two strings: "one"; and "two". Then a
|
* First a list is created consisting of two strings: "one" and "two". Then a
|
||||||
* stream is created from that list. Next the list is modified by adding a third
|
* stream is created from that list. Next the list is modified by adding a third
|
||||||
* string: "three". Finally the elements of the stream are collected and joined
|
* string: "three". Finally the elements of the stream are collected and joined
|
||||||
* together. Since the list was modified before the terminal {@code collect}
|
* together. Since the list was modified before the terminal {@code collect}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue