-
Notifications
You must be signed in to change notification settings - Fork 15
exclude
Mahmoud Ben Hassine edited this page Nov 21, 2015
·
5 revisions
Exclude elements matching a predicate from a stream.
This is the opposite behavior of filter.
Name | Type | Mandatory | Default |
---|---|---|---|
predicate | Predicate | Yes | N/A |
Stream<String> stream = Stream.of("a", "b");
UnixStream.unixify(stream)
.exclude(contains("a"))
.to(stdOut()); // prints "b"
// Or
UnixStream.from(stream)
.pipe(exclude(contains("a")))
.to(stdOut()); // prints "b"
// Or
stream
.filter(Predicates.exclude(contains("a")))
.forEach(System.out::println); // prints "b"
UnixStream is created with passion by Mahmoud Ben Hassine