Reuse JRE Arrays.fill().

This commit is contained in:
Gary Gregory 2021-01-06 21:01:32 -05:00
parent e739844b11
commit f5ce8c408a
1 changed files with 1 additions and 4 deletions

View File

@ -6249,9 +6249,7 @@ public class StringUtils {
return EMPTY;
}
final char[] buf = new char[repeat];
for (int i = repeat - 1; i >= 0; i--) {
buf[i] = ch;
}
Arrays.fill(buf, ch);
return new String(buf);
}
@ -6275,7 +6273,6 @@ public class StringUtils {
*/
public static String repeat(final String str, final int repeat) {
// Performance tuned for 2.0 (JDK1.4)
if (str == null) {
return null;
}