Skip to content

Commit e2b2a1f

Browse files
committed
Chars as int stream
1 parent 7e0da89 commit e2b2a1f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/com/winterbe/java8/samples/misc/String1.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@ public class String1 {
1010

1111
public static void main(String[] args) {
1212
testJoin();
13+
testChars();
1314
testPatternPredicate();
1415
testPatternSplit();
1516
}
1617

18+
private static void testChars() {
19+
String string = "foobar";
20+
string.chars()
21+
.filter(c -> c > 100)
22+
.mapToObj(c -> (char)c)
23+
.forEach(System.out::println);
24+
}
25+
1726
private static void testPatternSplit() {
1827
Pattern.compile(":")
1928
.splitAsStream("foobar:foo:bar")

0 commit comments

Comments
 (0)