Reuse JRE Arrays.fill().
This commit is contained in:
parent
e739844b11
commit
f5ce8c408a
|
@ -6249,9 +6249,7 @@ public class StringUtils {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
}
|
}
|
||||||
final char[] buf = new char[repeat];
|
final char[] buf = new char[repeat];
|
||||||
for (int i = repeat - 1; i >= 0; i--) {
|
Arrays.fill(buf, ch);
|
||||||
buf[i] = ch;
|
|
||||||
}
|
|
||||||
return new String(buf);
|
return new String(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6275,7 +6273,6 @@ public class StringUtils {
|
||||||
*/
|
*/
|
||||||
public static String repeat(final String str, final int repeat) {
|
public static String repeat(final String str, final int repeat) {
|
||||||
// Performance tuned for 2.0 (JDK1.4)
|
// Performance tuned for 2.0 (JDK1.4)
|
||||||
|
|
||||||
if (str == null) {
|
if (str == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue