Reputation: 1555
I am trying to debug a simple Java application which is using Lambda Expression. I am not able to debug Lambda Expression using normal Eclipse debugger.
Upvotes: 10
Views: 22111
Reputation: 54
It's late answer but hope it is useful for someone. I use this https://stackoverflow.com/a/24542150/10605477 but sometimes when code is a bit messy or I can't get data I just break the code and insert peek.
protected Optional<Name> get(String username) {
return profileDao.getProfiles()
.stream()
.filter(profile ->
profile.getUserName().equals(username))
.peek(data -> System.out.println(data))
.findFirst();
}
Upvotes: 3
Reputation: 5316
You can transform the expressions into statements.
List<String> list = new ArrayList<>();
// expression
boolean allMatch1 = list.stream().allMatch(s -> s.contains("Hello"));
// statement
boolean allMatch2 = list.stream().allMatch(s -> {
return s.contains("Hello");
});
You can now set the break-point on the return s.contains("Hello");
line
Upvotes: 2