I noticed there is a chapter in the book on "Tools, testing, debugging". I wonder whether debugging remains manageable and intuitional in such concise code employing streams, lambda expressions and the :: operator. Did you already have the chance to gain experience in debugging Java 8 code in some IDE? For instance, have you tried stepping into a lambda expression?
Interesting question. I just tried with the following code (in eclipse):
I put a breakpoint on the first line of main(...), and then stepped into debugLambda(...). I then stepped into function.apply(...), and the execution pointer jumped back to the lambda in main(...). The variables box in the debug perspective showed one local variable called 'string', that had the value "12". Looked perfectly sensible and usable to me.
we renamed the chapter "Refactoring, Testing, and Debugging". The new ToC will be updated soon and the content should be up shortly. In a nutshell, this chapter has more emphasis on refactoring: we discuss patterns to apply in your code and how typical object-oriented design patterns can be refactored using lambdas
Regarding debugging, you can set break points in a lambda expressions as you would normally do in your code. However, make sure the lambda is on multiple lines so you can set a line individually. Similarly for a stream pipeline. Instead of writing:
You should write:
So you can set break points on the individual operations.
The Debugging section specifically discusses on to examine stack traces (lambda expression makes things slightly less readable) and how to debugg/log information in a stream pipeline using the operation peek().