Java Streams Basics: The Useful peek Method #java #shorts #coding #airhacks

preview_player
Показать описание
Debugging with peek:

#airhacks
Рекомендации по теме
Комментарии
Автор

Peek is nog guaranteed to execute. It can be optimized away in some scenarios

IstvanOosterlinck
Автор

This is really cool for debugging. Because sometimes you just want to check if your long chain of steaming methods are doing the right thing! Nice! So you could also use a logger as consumer, right?

datenschauer
Автор

I've been using Streams almost since the beginning but never came across peek. I can imagine a lot of use cases. It's similar to Unix tee command.

foobartuba
Автор

On mobile I can't see the result of console(terminal)

akojic