London Lambdas Hackday: Developer Practices

Brian Goetz brian.goetz at oracle.com
Wed Jul 4 08:45:45 PDT 2012


Its a hack (just like a println), but it does not alter the evaluation 
pattern at all.  It simply gives you a place to hang a breakpoint to 
peek at values as they come down the pipe.

The harder thing to come to grips with is that we're used to having all 
the filtering happen first, then all the mapping.  But that's not what's 
really going on.

On 7/4/2012 9:48 AM, Richard Warburton wrote:
>> Nevertheless, you can use two workarounds in this situation. 1/ As Brian
>> said, insert a print call in the chaining, but you need the tee method and
>> you cannot use this with a debugger. 2/ You can put part of the chaining in
>
> You could use a debugger if you had used empty function and
> breakpointed on that:
>
>    list.filter(...)
>        .tee(x -> {}) // breakpoint within this lambda
>        .map(...)
>
> It's still a hack though.  Furthermore it potentially alters the
> evaluation pattern of the expression depending upon whether its
> chaining a lazy or strict collection.
>
> regards,
>
>    Richard
>



More information about the lambda-dev mailing list