public static void main(String[] args) {
var s1 = Stream.of(2, 1, 3); // Stream < Integer >
var s2 = s1.zip(List.of(7, 8, 9)); // Stream <Tuple2< Integer, Integer >>
var integers = s2.map(tuple2 -> tuple2._1 + tuple2._2).collect(Collectors.toList());
integers.forEach(System.out::println);
}
// Java9+
var integers = Pattern.compile("-?\\d+").matcher(source)
.results() // Stream<MatchResult>
.map(MatchResult::group) // Stream<String>
.map(Integer::valueOf)
.toArray(Integer[]::new);
// Java8
Integer[] integersJ8 = Pattern.compile(",")
.splitAsStream(source)
.map(String::trim)
.map(Integer::valueOf)
.toArray(Integer[]::new);