2

How can I put a conditional breakpoint in a lambda expression in IntelliJ. For eg. I have a statement stream().map(s -> s * 2).forEach(...). I want to put a conditional breakpoint s == 5 on this statement.

IntelliJ doesn't recognize s as valid. Why is that?

raviolicode
  • 2,155
  • 21
  • 22
Salil Surendran
  • 2,245
  • 4
  • 27
  • 42

1 Answers1

1

This is not part of IntelliJ 14, but it will be part of IntelliJ 15.

You can see it is part of the features being added and you can probably download the EAP Build and check if it already has this feature implemented.

Than being said, in IntelliJ 14 you can still stop in a lambda if you change it (momentarily for debugging purposes) to a block of code.

stream().map(s -> { return s * 2; }).forEach(x -> {System.out.println(x); });

IntelliJ does let me put a break point within the lambda block. It will still complain/suggest that this can be simplified to a lambda without the block of code, but you can leave it like this momentarily while you debug it and change it to a simpler expression once you're sure everything works.

Edwin Dalorzo
  • 76,803
  • 25
  • 144
  • 205