Skip to content

Commit

Permalink
add javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmoten committed Dec 3, 2024
1 parent 8c1933c commit 756d795
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions kool/src/main/java/org/davidmoten/kool/Stream.java
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,22 @@ default <S> Stream<S> bufferUntil(Callable<? extends S> factory,
step, maxReplay);
}

/**
* Buffers while a condition is true then emits the buffer and starts a new
* buffer for emission.
*
* @param <S> buffer type
* @param factory factory method to create a new buffer
* @param accumulator how to incorporate a stream element into the buffer
* @param condition if true then stream element is incorporated into the
* buffer
* @param emitRemainder what to do with the final buffer
* @param step function that defines overlap (or not) of buffers
* @param maxReplay overlap of buffers is achieved efficiently via a ring
* buffer (the stream is made replayable to handle buffer
* overlaps (e.g step = 1)
* @return buffered stream
*/
default <S> Stream<S> bufferWhile(Callable<? extends S> factory,
BiFunction<? super S, ? super T, ? extends S> accumulator, BiPredicate<? super S, ? super T> condition,
boolean emitRemainder, Function<? super S, Integer> step, int maxReplay) {
Expand Down

0 comments on commit 756d795

Please sign in to comment.