Skip to content

exclude

Mahmoud Ben Hassine edited this page Nov 8, 2015 · 5 revisions

exclude

Synopsis

Exclude elements matching a predicate from a stream.

This is the opposite behaviour of filter.

Parameters

Name Type Mandatory Default
predicate Predicate Yes N/A

Example

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"
Clone this wiki locally