IDEA-205846 Suggestion to use String.repeat where appropriate when using JDK 11

This commit is contained in:
Tagir Valeev
2019-01-24 12:51:43 +07:00
parent 43414b9d46
commit bfad8296ba
15 changed files with 332 additions and 0 deletions
@@ -0,0 +1,8 @@
// "Replace with 'String.repeat()'" "true"
class Test {
String spaces(int a, int b, int c, int d) {
StringBuilder sb = new StringBuilder();
sb.append(" ".repeat(Math.max(0, c - d - (a - b))));
return sb.toString();
}
}