This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new f5ce8c4 Reuse JRE Arrays.fill().
f5ce8c4 is described below
commit f5ce8c408aa7047efa0f9d418c2d93eddb0a4a63
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Jan 6 21:01:32 2021 -0500
Reuse JRE Arrays.fill().
---
src/main/java/org/apache/commons/lang3/StringUtils.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java
b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 5147215..f6f7a16 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -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;
}