Example:
System.out.println("----flatMapToInt----");
Stream<List<Integer>> list = Stream.of(
Arrays.asList(1,2,3,4),
Arrays.asList(10,20,30,40)
);
IntSteam list2 = list.flatMapToInt(...);
or otherwise
CodePudding user response:
you can do like this: IntStream intStream = list.flatMapToInt(l -> l.stream().mapToInt(i -> i));