How to debug Java 8 streams in Intelij IDEA?
How to debug Java 8 streams in Intelij IDEA? All intermediate calls are lazy and are executed during a terminal operation, so it makes no sense to wrap methods on separate lines. I haven't yet been able to get the idea to show the elements of the stream at some step other than the start and end. System.out. println arrange-somehow unprofessional, are there other ways out of the box?
2 answers
Starting from version 2017.3, IDEA has a Stream Debugger built in.
You can activate it when the debugger stopped on the stream:
Stream Debugger visualizes each step of the stream, clearly showing the filtering and transformation of elements:
I think the best thing is to put a Breakpoint with conditions. You can set the conditions of the intermediate function.
- Creating A Breakpoint
- set conditions on a variable or variables
- debag will stop at the specified location under the specified conditions
Something like this