8276904: Optional.toString() is unnecessarily expensive

Reviewed-by: rriggs, smarks
This commit is contained in:
Eamonn McManus 2021-12-08 21:24:43 +00:00
parent 6e7b7f352e
commit fe2ae8e38b
4 changed files with 4 additions and 4 deletions

View file

@ -326,7 +326,7 @@ public final class OptionalInt {
@Override
public String toString() {
return isPresent
? String.format("OptionalInt[%s]", value)
? ("OptionalInt[" + value + "]")
: "OptionalInt.empty";
}
}