pjfanning commented on code in PR #1824: URL: https://github.com/apache/pekko/pull/1824#discussion_r2051776147
########## stream/src/main/java/org/apache/pekko/stream/javadsl/BufferUntilChanged.java: ########## @@ -0,0 +1,113 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * license agreements; and to You under the Apache License, version 2.0: + * + * https://www.apache.org/licenses/LICENSE-2.0 + */ + +package org.apache.pekko.stream.javadsl; + +import org.apache.pekko.NotUsed; +import org.apache.pekko.annotation.ApiMayChange; +import org.apache.pekko.japi.function.Function; +import org.apache.pekko.japi.function.Function2; +import org.apache.pekko.stream.javadsl.Flow; +import org.apache.pekko.stream.javadsl.Source; + +import java.util.List; + +/** + * Java API: Additional buffer operations for Flow and Source. + */ +public final class BufferUntilChanged { + + private BufferUntilChanged() {} + + /** + * Collect subsequent repetitions of an element (that is, if they arrive right after one another) into multiple + * `List` buffers that will be emitted by the resulting Flow. + * + * @param <T> the element type + * @return a Flow that buffers elements until they change + */ + @ApiMayChange + public static <T> Flow<T, List<T>, NotUsed> flow() { + return Flow.<T>create().asScala().bufferUntilChanged().asJava(); + } + + /** + * Collect subsequent repetitions of an element (that is, if they arrive right after one another), as compared by a key Review Comment: lines are too long -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
