diff --git a/src/share/classes/java/util/stream/DoubleStream.java b/src/share/classes/java/util/stream/DoubleStream.java index 68d792d38ba0b58fa0909e5a2451f8e4861dd08e..163e5c42d933008d1bf60b25af2d59a1a9a2d455 100644 --- a/src/share/classes/java/util/stream/DoubleStream.java +++ b/src/share/classes/java/util/stream/DoubleStream.java @@ -207,12 +207,12 @@ public interface DoubleStream extends BaseStream { * @apiNote This method exists mainly to support debugging, where you want * to see the elements as they flow past a certain point in a pipeline: *
{@code
-     *     list.stream()
-     *         .filter(filteringFunction)
-     *         .peek(e -> System.out.println("Filtered value: " + e));
-     *         .map(mappingFunction)
-     *         .peek(e -> System.out.println("Mapped value: " + e));
-     *         .collect(Collectors.toDoubleSummaryStastistics());
+     *     DoubleStream.of(1, 2, 3, 4)
+     *         .filter(e -> e > 2)
+     *         .peek(e -> System.out.println("Filtered value: " + e))
+     *         .map(e -> e * e)
+     *         .peek(e -> System.out.println("Mapped value: " + e))
+     *         .sum();
      * }
* * @param action a diff --git a/src/share/classes/java/util/stream/IntStream.java b/src/share/classes/java/util/stream/IntStream.java index b9fae57c7c70a1fd3c65c50ad3043a7a399fc968..3030f46e6624bc900a1267a4208b880bb794b30b 100644 --- a/src/share/classes/java/util/stream/IntStream.java +++ b/src/share/classes/java/util/stream/IntStream.java @@ -200,12 +200,12 @@ public interface IntStream extends BaseStream { * @apiNote This method exists mainly to support debugging, where you want * to see the elements as they flow past a certain point in a pipeline: *
{@code
-     *     list.stream()
-     *         .filter(filteringFunction)
-     *         .peek(e -> System.out.println("Filtered value: " + e));
-     *         .map(mappingFunction)
-     *         .peek(e -> System.out.println("Mapped value: " + e));
-     *         .collect(Collectors.toIntSummaryStastistics());
+     *     IntStream.of(1, 2, 3, 4)
+     *         .filter(e -> e > 2)
+     *         .peek(e -> System.out.println("Filtered value: " + e))
+     *         .map(e -> e * e)
+     *         .peek(e -> System.out.println("Mapped value: " + e))
+     *         .sum();
      * }
* * @param action a
diff --git a/src/share/classes/java/util/stream/LongStream.java b/src/share/classes/java/util/stream/LongStream.java index d9fe6b391a552db4c666e4397c4aa3ff3d9e28fc..983afef780d4ba829d77b28a3a77deeb379c600a 100644 --- a/src/share/classes/java/util/stream/LongStream.java +++ b/src/share/classes/java/util/stream/LongStream.java @@ -205,12 +205,12 @@ public interface LongStream extends BaseStream { * @apiNote This method exists mainly to support debugging, where you want * to see the elements as they flow past a certain point in a pipeline: *
{@code
-     *     list.stream()
-     *         .filter(filteringFunction)
-     *         .peek(e -> System.out.println("Filtered value: " + e));
-     *         .map(mappingFunction)
-     *         .peek(e -> System.out.println("Mapped value: " + e));
-     *         .collect(Collectors.toLongSummaryStastistics());
+     *     LongStream.of(1, 2, 3, 4)
+     *         .filter(e -> e > 2)
+     *         .peek(e -> System.out.println("Filtered value: " + e))
+     *         .map(e -> e * e)
+     *         .peek(e -> System.out.println("Mapped value: " + e))
+     *         .sum();
      * }
* * @param action a
diff --git a/src/share/classes/java/util/stream/Stream.java b/src/share/classes/java/util/stream/Stream.java index 9c88e6887bb14d188422ef15ce4308afbe5d1996..966cd7913a08da39924c1a91c0579fe1cc799928 100644 --- a/src/share/classes/java/util/stream/Stream.java +++ b/src/share/classes/java/util/stream/Stream.java @@ -403,12 +403,12 @@ public interface Stream extends BaseStream> { * @apiNote This method exists mainly to support debugging, where you want * to see the elements as they flow past a certain point in a pipeline: *
{@code
-     *     list.stream()
-     *         .filter(filteringFunction)
-     *         .peek(e -> System.out.println("Filtered value: " + e));
-     *         .map(mappingFunction)
-     *         .peek(e -> System.out.println("Mapped value: " + e));
-     *         .collect(Collectors.intoList());
+     *     Stream.of("one", "two", "three", "four")
+     *         .filter(e -> e.length() > 3)
+     *         .peek(e -> System.out.println("Filtered value: " + e))
+     *         .map(String::toUpperCase)
+     *         .peek(e -> System.out.println("Mapped value: " + e))
+     *         .collect(Collectors.toList());
      * }
* * @param action a