我正在尝试调试一个使用Lambda表达式的简单Java应用程序。我不能使用普通的Eclipse调试器来调试Lambda表达式。
发布于 2018-11-19 23:19:38
这是迟来的答案,但希望对某些人有用。我使用这个https://stackoverflow.com/a/24542150/10605477,但有时当代码有点混乱,或者我无法获取数据时,我会直接拆分代码并插入窥视。
protected Optional<Name> get(String username) {
return profileDao.getProfiles()
.stream()
.filter(profile ->
profile.getUserName().equals(username))
.peek(data -> System.out.println(data))
.findFirst();
}发布于 2016-09-22 23:36:25
您可以将表达式转换为语句。
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");
});现在可以在return s.contains("Hello");行上设置断点
https://stackoverflow.com/questions/39637183
复制相似问题