8241649: Optimize Character.toString

Reviewed-by: redestad, rriggs
This commit is contained in:
Sergei Tsypanov 2020-03-26 10:02:57 +01:00 committed by Claes Redestad
parent b8f8dea9c2
commit b35032dc01

View File

@ -3285,7 +3285,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
"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
@ -8068,7 +8068,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
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);
@ -8421,8 +8421,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* @return a string representation of this object.
*/
public String toString() {
char buf[] = {value};
return String.valueOf(buf);
return String.valueOf(value);
}
/**