feat: Add dropRepeated stream operator. (#1868)
This commit is contained in:
parent
9227912ea6
commit
e6662e12de
14 changed files with 423 additions and 5 deletions
|
|
@ -58,16 +58,12 @@ import java.util.*;
|
|||
// #zip
|
||||
|
||||
// #log
|
||||
import org.apache.pekko.event.LogMarker;
|
||||
import org.apache.pekko.stream.Attributes;
|
||||
|
||||
// #log
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionStage;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class SourceOrFlow {
|
||||
private static ActorSystem system = null;
|
||||
|
|
@ -608,6 +604,21 @@ class SourceOrFlow {
|
|||
// #filterNot
|
||||
}
|
||||
|
||||
void dropRepeatedExample() {
|
||||
// #dropRepeated
|
||||
Source.from(Arrays.asList(1, 2, 2, 3, 3, 1, 4))
|
||||
.dropRepeated()
|
||||
.runForeach(System.out::println, system);
|
||||
// prints:
|
||||
// 1
|
||||
// 2
|
||||
// 3
|
||||
// 1
|
||||
// 4
|
||||
|
||||
// #dropRepeated
|
||||
}
|
||||
|
||||
void dropExample() {
|
||||
// #drop
|
||||
Source<Integer, NotUsed> fiveIntegers = Source.from(Arrays.asList(1, 2, 3, 4, 5));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue