I have a small problem, namely I want to get Integer from a String via lambda expression. I wrote small code but i get only single chars.
Example:
String = "He11o W00rld"
I get [1, 1, 0, 0] but I want [11, 00]. Is there any solution for this?
My code:
Function<String, List<Integer>> collectInts = f -> {
return f.chars()
.filter( s -> (s > 47 && s < 58))
.map(r -> r - 48)
.boxed()
.collect(Collectors.toList());};
Pattern#splitAsStream()