> class LocalTime {
> public String toString() {
> // ...
> if (nanoValue % 1000_000 == 0) {
> buf.append(Integer.toString((nanoValue / 1000_000) +
> 1000).substring(1));
> } else if (nanoValue % 1000 == 0) {
> buf.append(Integer.toString((nanoValue / 1000) +
> 1000_000).substring(1));
> } else {
> buf.append(Integer.toString((nanoValue) +
> 1000_000_000).substring(1));
> }
> // ...
> }
> }
>
> Currently, LocalTime.toString handles nanos by adding a value and then
> subString(1) to fill it with zeros. Using StringBuilder.repeat is more
> concise and has better performance.
Shaojin Wen has updated the pull request incrementally with two additional
commits since the last revision:
- add benchmark
- remove JLA
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/20232/files
- new: https://git.openjdk.org/jdk/pull/20232/files/aa0af2fa..ac302761
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=20232&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=20232&range=00-01
Stats: 154 lines in 3 files changed: 150 ins; 2 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/20232.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/20232/head:pull/20232
PR: https://git.openjdk.org/jdk/pull/20232