IDEA debugs the Stream stream to view the specific process

Remarks

Starting from this article, I will only record what I think is important to myself, not what is important to readers, because you can't do me any favors!

Preface

IDEA's support for Stream is actually very complete. We can debug the Stream to view the specific processing process and results of the stream data.

start

Let's first put a breakpoint on the line that converts the collection or array into a stream object, as shown in the figure:
Insert image description here

Then click debug to run, as shown in the figure:
Insert image description here

Click the button in the picture above to Trace Current Stream Chainopen the Stream data processing interface, as shown in the picture:
Insert image description here

There is nothing when we first come in, because we need to get the data first. After we wait for a while, we can see the initial data, as shown in the figure:
Insert image description here

What operations we have performed on the data will be displayed on the interface. By clicking each button, we can view the data before this operation and the result data after the operation. It is very clear:
Insert image description here

Other operations are similar, so I won’t go into details here!

Guess you like

Origin blog.csdn.net/qq_47188967/article/details/131954164