org.sonar.l10n.java.rules.squid.S1602.html Maven / Gradle / Ivy
The newest version!
There are two ways to write lambdas that contain single statement, but one is definitely more compact and readable than the other.
Noncompliant Code Example
x -> {System.out.println(x+1);}
(a, b) -> { return a+b; }
Compliant Solution
x -> System.out.println(x+1)
(a, b) -> a+b //For return statement, the return keyword should also be dropped
© 2015 - 2025 Weber Informatics LLC | Privacy Policy