OPT.STR
Use ' ' instead of " " for one character string concatenation
Description
This rule flags code that uses "" for string concatenation with one character.
Using `' instead of "" for one character string concatenation will improve performance.
Example
package OPT;
public class STR {
public void method(String s) {
String string = s + "d" // violation.
string = "abc" + "d" // violation.
}
}
Repair
Replace one character String Constant with ' '.
package OPT;
public class STR {
public void method(String s) {
String string = s + 'd'
string = "abc" + 'd'
}
}
|