Use java8-api Refactor-Testing-Debuggingjava
Examining values flowing in a stream pipeline with peekapi
Use peek to print the intermediate value before and after each operation in the stream pipelinespa
@Test
public void tset(){
List<Integer> numbvers= Arrays.asList(2,3,4,5,6);
List<Integer> result=numbvers.stream().peek(x-> System.out.println("from stream:" +x))
.map(x->x+1).peek(x-> System.out.println("after map:"+x)).filter(x->x%2==0)
.peek(x-> System.out.println("after filter:"+x))
.limit(3)
.peek(x-> System.out.println("after limit:"+x))
.collect(Collectors.toList());
}.net