-
Notifications
You must be signed in to change notification settings - Fork 15
fold
Mahmoud Ben Hassine edited this page Nov 21, 2015
·
4 revisions
Folds Strings with a given width in a stream of Strings.
Name | Type | Mandatory | Default |
---|---|---|---|
width | int | No | 80 |
Stream<String> stream = Stream.of("abc", "def");
UnixStream.unixify(stream)
.fold(2)
.to(stdOut());
/* prints:
ab
c
de
f
*/
// Or
UnixStream.from(stream)
.pipe(fold(2))
.to(stdOut());
/* prints:
ab
c
de
f
*/
// Or
stream
.map(Functions.fold(2))
.forEach(System.out::println);
/* prints:
ab
c
de
f
*/
UnixStream is created with passion by Mahmoud Ben Hassine