Skip to content

Commit c98868c

Browse files
TennyZhuangGoogle Java Core Libraries
authored andcommitted
Refine examples for mapWithIndex.
Fixes google#5793 RELNOTES=n/a PiperOrigin-RevId: 415104694
1 parent 8652b45 commit c98868c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

guava/src/com/google/common/collect/Streams.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,10 @@ private static class TemporaryPair<A extends @Nullable Object, B extends @Nullab
410410
* <pre>{@code
411411
* mapWithIndex(
412412
* Stream.of("a", "b", "c"),
413-
* (str, index) -> str + ":" + index)
413+
* (e, index) -> index + ":" + e)
414414
* }</pre>
415415
*
416-
* <p>would return {@code Stream.of("a:0", "b:1", "c:2")}.
416+
* <p>would return {@code Stream.of("0:a", "1:b", "2:c")}.
417417
*
418418
* <p>The resulting stream is <a
419419
* href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html">efficiently splittable</a>
@@ -493,11 +493,11 @@ Splitr createSplit(Spliterator<T> from, long i) {
493493
*
494494
* <pre>{@code
495495
* mapWithIndex(
496-
* IntStream.of(0, 1, 2),
497-
* (i, index) -> i + ":" + index)
496+
* IntStream.of(10, 11, 12),
497+
* (e, index) -> index + ":" + e)
498498
* }</pre>
499499
*
500-
* <p>...would return {@code Stream.of("0:0", "1:1", "2:2")}.
500+
* <p>...would return {@code Stream.of("0:10", "1:11", "2:12")}.
501501
*
502502
* <p>The resulting stream is <a
503503
* href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html">efficiently splittable</a>
@@ -573,11 +573,11 @@ Splitr createSplit(Spliterator.OfInt from, long i) {
573573
*
574574
* <pre>{@code
575575
* mapWithIndex(
576-
* LongStream.of(0, 1, 2),
577-
* (i, index) -> i + ":" + index)
576+
* LongStream.of(10, 11, 12),
577+
* (e, index) -> index + ":" + e)
578578
* }</pre>
579579
*
580-
* <p>...would return {@code Stream.of("0:0", "1:1", "2:2")}.
580+
* <p>...would return {@code Stream.of("0:10", "1:11", "2:12")}.
581581
*
582582
* <p>The resulting stream is <a
583583
* href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html">efficiently splittable</a>
@@ -653,11 +653,11 @@ Splitr createSplit(Spliterator.OfLong from, long i) {
653653
*
654654
* <pre>{@code
655655
* mapWithIndex(
656-
* DoubleStream.of(0, 1, 2),
657-
* (x, index) -> x + ":" + index)
656+
* DoubleStream.of(0.0, 1.0, 2.0)
657+
* (e, index) -> index + ":" + e)
658658
* }</pre>
659659
*
660-
* <p>...would return {@code Stream.of("0.0:0", "1.0:1", "2.0:2")}.
660+
* <p>...would return {@code Stream.of("0:0.0", "1:1.0", "2:2.0")}.
661661
*
662662
* <p>The resulting stream is <a
663663
* href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html">efficiently splittable</a>

0 commit comments

Comments
 (0)