feat: Add collectWhile operator. (#964)

This commit is contained in:
He-Pin(kerr) 2024-01-17 01:07:47 +08:00 committed by GitHub
parent 11ba3d7bef
commit 19da73673d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 347 additions and 4 deletions

View file

@ -401,6 +401,17 @@ class SourceOrFlow {
// #collect
}
void collectWhileExample() {
// #collectWhile
Flow<Message, Pong, NotUsed> flow =
Flow.of(Message.class)
.collectWhile(
PFBuilder.<Message, Pong>create()
.match(Ping.class, p -> p.id <= 100, p -> new Pong(p.id))
.build());
// #collectWhile
}
void collectTypeExample() {
// #collectType
Flow<Message, Pong, NotUsed> flow =