rspec/rules/S1611/java/rule.adoc
2022-02-04 16:28:24 +00:00

38 lines
791 B
Plaintext

There are two possible syntaxes for a lambda having only one input parameter with an inferred type: with and without parentheses around that single parameter. The simpler syntax, without parentheses, is more compact and readable than the one with parentheses, and is therefore preferred.
*Note* that this rule is automatically disabled when the project's ``++sonar.java.source++`` is lower than ``++8++``.
== Noncompliant Code Example
[source,java]
----
(x) -> x * 2
----
== Compliant Solution
[source,java]
----
x -> x * 2
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]