rspec/rules/S3706/java/rule.adoc

30 lines
590 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
There's no need to invoke ``++stream()++`` on a ``++Collection++`` before a ``++forEach++`` call because each ``++Collection++`` has its own ``++forEach++`` method.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,java]
2021-04-28 16:49:39 +02:00
----
identifiers.stream().forEach(System.out::println); // Noncompliant
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,java]
2021-04-28 16:49:39 +02:00
----
identifiers.forEach(System.out::println); // Noncompliant
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
include::highlighting.adoc[]
endif::env-github,rspecator-view[]