rspec/rules/S1153/java/rule.adoc

20 lines
455 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
Appending ``++String.valueOf()++`` to a ``++String++`` decreases the code readability.
The argument passed to ``++String.valueOf()++`` should be directly appended instead.
== Noncompliant Code Example
----
public void display(int i){
System.out.println("Output is " + String.valueOf(i)); // Noncompliant
}
----
== Compliant Solution
----
public void display(int i){
System.out.println("Output is " + i); // Compliant
}
----