Skip to content

Commit

Permalink
8241649: Optimize Character.toString
Browse files Browse the repository at this point in the history
Reviewed-by: redestad, rriggs
  • Loading branch information
stsypanov authored and cl4es committed Mar 26, 2020
1 parent b8f8dea commit b35032d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/java.base/share/classes/java/lang/Character.java
Original file line number Diff line number Diff line change
Expand Up @@ -3285,7 +3285,7 @@ private UnicodeBlock(String idName, String... aliases) {
"SYMBOLS AND PICTOGRAPHS EXTENDED-A",
"SYMBOLSANDPICTOGRAPHSEXTENDED-A");

private static final int blockStarts[] = {
private static final int[] blockStarts = {
0x0000, // 0000..007F; Basic Latin
0x0080, // 0080..00FF; Latin-1 Supplement
0x0100, // 0100..017F; Latin Extended-A
Expand Down Expand Up @@ -8068,7 +8068,7 @@ public static enum UnicodeScript {
UNKNOWN, // E01F0..10FFFF
};

private static HashMap<String, Character.UnicodeScript> aliases;
private static final HashMap<String, Character.UnicodeScript> aliases;
static {
aliases = new HashMap<>((int)(153 / 0.75f + 1.0f));
aliases.put("ADLM", ADLAM);
Expand Down Expand Up @@ -8421,8 +8421,7 @@ public boolean equals(Object obj) {
* @return a string representation of this object.
*/
public String toString() {
char buf[] = {value};
return String.valueOf(buf);
return String.valueOf(value);
}

/**
Expand Down

0 comments on commit b35032d

Please sign in to comment.