Skip to content

Commit 5714312

Browse files
committed
Initialize in declaration
1 parent 139a25a commit 5714312

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/main/java/org/apache/commons/lang3/CharUtils.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
public class CharUtils {
3232

33-
private static final String[] CHAR_STRING_ARRAY = new String[128];
33+
private static final String[] CHAR_STRING_ARRAY = ArrayUtils.setAll(new String[128], i -> String.valueOf((char) i));
3434

3535
private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
3636

@@ -59,10 +59,6 @@ public class CharUtils {
5959
*/
6060
public static final char NUL = '\0';
6161

62-
static {
63-
ArrayUtils.setAll(CHAR_STRING_ARRAY, i -> String.valueOf((char) i));
64-
}
65-
6662
/**
6763
* Compares two {@code char} values numerically. This is the same functionality as provided in Java 7.
6864
*

0 commit comments

Comments
 (0)