Open GuiSim opened 8 years ago
The guide currently contains an example with Lambda: https://github.com/google/styleguide/blob/gh-pages/javaguide.html#L283-L287
return () -> {
while (condition()) {
method();
}
};
But it is not enough to understand how to handle curly braces in the following code:
void foo1() {
Stream.of("Hello").filter(s -> {
return s != null;
}
).collect(Collectors.toList());
Stream.of("Hello").filter(s -> {
return s != null;
}).collect(Collectors.toList());
Stream.of("Hello").filter(s -> {return s != null;})
.collect(Collectors.toList());
Stream.of("Hello").filter(s -> {return s != null;}).collect(Collectors.toList());
Stream.of("Hello").filter(s -> {
return s != null;}).collect(Collectors.toList());
bar(() -> {return;}, () -> {return;});
bar(() -> {
return;
}, () -> {return;});
bar(() -> {
return;
}, () -> {
return;
});
bar(() -> {
return;}, () -> {return;});
bar(() -> {
return;
}, () -> {
return;});
}
void bar(Runnable r1, Runnable r2) { }
We are about to finish adding Lambda to RightCurlyCheck in Checkstyle (https://github.com/checkstyle/checkstyle/issues/3546) and the next step would be adding it to google_checks
config (https://github.com/checkstyle/checkstyle/issues/4178), so please provide clarification.
Java 8 supports Lambda functions but they do not appear to be part of the documentation for the Java Styleguide.