<i18n dev> RFR: 8300818: Reduce complexity of padding with DateTimeFormatter
Sergey Tsypanov
stsypanov at openjdk.org
Sat Jan 21 21:20:49 UTC 2023
Currently it's O(n) - we do `n` shifts of bytes within `StringBuilder`. This can be reduced to O(1) improving the code like:
DateTimeFormatter dtf = new DateTimeFormatterBuilder()
.appendLiteral("Date:")
.padNext(20, ' ')
.append(DateTimeFormatter.ISO_DATE)
.toFormatter();
String text = dtf.format(LocalDateTime.now());
-------------
Commit messages:
- Improve padding of DateTimeFormatter
Changes: https://git.openjdk.org/jdk/pull/12131/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12131&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8300818
Stats: 5 lines in 1 file changed: 0 ins; 2 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/12131.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12131/head:pull/12131
PR: https://git.openjdk.org/jdk/pull/12131
More information about the i18n-dev
mailing list