<i18n dev> RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

Roger Riggs rriggs at openjdk.org
Fri Mar 24 19:34:32 UTC 2023


On Sun, 22 Jan 2023 09:50:21 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:

>> 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());
>
> Sergey Tsypanov has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge branch 'master' into dtfb
>  - Improve padding of DateTimeFormatter

fyi, you might want to wait for https://github.com/openjdk/jdk/pull/12728

-------------

PR Comment: https://git.openjdk.org/jdk/pull/12131#issuecomment-1466817993


More information about the i18n-dev mailing list