Closed lukaseder closed 5 years ago
The current implementation on e.g. UByte.toString() is:
UByte.toString()
@Override public String toString() { return Short.valueOf(value).toString(); }
This produces an unnecessary allocation of a java.lang.Short, when instead, we could write
java.lang.Short
@Override public String toString() { return Short.toString(value); }
Other types are also affected.
Credits to @knutwannheden for discovering this.
In the scope of this issue I will also fix the hashCode() methods which can be optimized in the exact same way.
hashCode()
Agreed
Unfortunately only since Java 1.8, so not in jOOU-java-6.
jOOU-java-6
The current implementation on e.g.
UByte.toString()
is:This produces an unnecessary allocation of a
java.lang.Short
, when instead, we could writeOther types are also affected.
Credits to @knutwannheden for discovering this.