@@ -698,8 +698,52 @@ trait SFlux[T] extends SFluxLike[T, SFlux] with MapablePublisher[T] with ScalaCo
698698 */
699699 final def sampleFirst (timespan : Duration ): SFlux [T ] = coreFlux.sampleFirst(timespan).asScala
700700
701+ /**
702+ * Reduce this [[SFlux ]] values with an accumulator [[Function2 ]] and
703+ * also emit the intermediate results of this function.
704+ * <p>
705+ * Unlike [[SFlux.scan(Anyref, Function2) ]], this operator doesn't take an initial value
706+ * but treats the first [[SFlux ]] value as initial value.
707+ * <br>
708+ * The accumulation works as follows:
709+ * <pre><code>
710+ * result[0] = source[0]
711+ * result[1] = accumulator(result[0], source[1])
712+ * result[2] = accumulator(result[1], source[2])
713+ * result[3] = accumulator(result[2], source[3])
714+ * ...
715+ * </code></pre>
716+ *
717+ * <p>
718+ * <img class="marble" src="https://raw.githubusercontent.com/reactor/reactor-core/master/reactor-core/src/main/java/reactor/core/publisher/doc-files/marbles/scanWithSameReturnType.svg" alt="">
719+ *
720+ * @param accumulator the accumulating [[Function2 ]]
721+ * @return an accumulating [[SFlux ]]
722+ */
701723 final def scan (accumulator : (T , T ) => T ): SFlux [T ] = coreFlux.scan(accumulator).asScala
702724
725+ /**
726+ * Reduce this [[SFlux ]] values with an accumulator [[Function2 ]] and
727+ * also emit the intermediate results of this function.
728+ * <p>
729+ * The accumulation works as follows:
730+ * <pre><code>
731+ * result[0] = initialValue;
732+ * result[1] = accumulator(result[0], source[0])
733+ * result[2] = accumulator(result[1], source[1])
734+ * result[3] = accumulator(result[2], source[2])
735+ * ...
736+ * </code></pre>
737+ *
738+ * <p>
739+ * <img class="marble" src="https://raw.githubusercontent.com/reactor/reactor-core/master/reactor-core/src/main/java/reactor/core/publisher/doc-files/marbles/scan.svg" alt="">
740+ *
741+ * @param initial the initial leftmost argument to pass to the reduce function
742+ * @param accumulator the accumulating [[Function2 ]]
743+ * @param < A> the accumulated type
744+ * @return an accumulating [[SFlux ]] starting with initial state
745+ *
746+ */
703747 final def scan [A >: T ](initial : => A )(accumulator : (A , A ) => A ): SFlux [A ] = coreFlux.scanWith(() => initial, accumulator).asScala
704748
705749// final def scanWith[A >: T](initial: () => A, accumulator: (A, T) => A): SFlux[A] = coreFlux.scanWith(initial, accumulator).asScala
0 commit comments