-
Notifications
You must be signed in to change notification settings - Fork 15
grep
Mahmoud Ben Hassine edited this page Nov 21, 2015
·
4 revisions
Keeps elements containing a given pattern in a stream of Strings.
Name | Type | Mandatory | Default |
---|---|---|---|
pattern | String | Yes | N/A |
Stream<String> stream = Stream.of("a", "ab", "bc");
UnixStream.unixify(stream)
.grep("a")
.to(stdOut()); // prints "a", "ab"
// Or
UnixStream.from(stream)
.pipe(grep("a"))
.to(stdOut()); // prints "a", "ab"
// Or
stream
.filter(Predicates.grep("a"))
.forEach(System.out::println); // prints "a", "ab"
UnixStream is created with passion by Mahmoud Ben Hassine