> This PR introduces a new efficient API for appending two-digit integers to 
> StringBuilders and refactors DateTimeHelper to leverage this new 
> functionality.
> 
> Changes include:
> 
> 1. New `appendPair` method for efficient two-digit integer formatting (00-99):
>    - Added `AbstractStringBuilder.appendPair(int i)` with core implementation
>    - Added `JavaLangAccess.appendPair(StringBuilder, int)` for internal access
>    - Added `System.JavaLangAccessImpl.appendPair(StringBuilder, int)` bridge
>    - Added `DecimalDigits.appendPair(StringBuilder, int)` public static 
> utility method
>    - Enhanced Javadoc documentation for all new methods
> 
> 2. Refactored `DateTimeHelper` to use the new `DecimalDigits.appendPair`:
>    - Updated `DateTimeHelper.formatTo` methods for `LocalDate` and `LocalTime`
>    - Replaced manual formatting logic with the new efficient two-digit 
> appending
>    - Improved code clarity and consistency in date/time formatting
> 
> These changes improve code clarity and performance when formatting two-digit 
> numbers, particularly in date/time formatting scenarios.

Shaojin Wen has updated the pull request incrementally with one additional 
commit since the last revision:

  Use DecimalDigits.appendPair for formatting in time classes
  
  This change modifies the toString() methods in MonthDay, YearMonth, 
ZoneOffset, and ChronoLocalDateImpl to use DecimalDigits.appendPair for 
formatting two-digit numbers. This provides a more efficient and consistent way 
to format these values.
  
  Also added a comment in ChronoLocalDateImpl.toString() to explain why get() 
is used instead of getLong() for performance reasons, as the values are 
guaranteed to be within the int range for all chronologies.
  
  Co-authored-by: Qwen-Coder <qwen-co...@alibabacloud.com>

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26911/files
  - new: https://git.openjdk.org/jdk/pull/26911/files/c56f16d1..916db357

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=26911&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26911&range=00-01

  Stats: 32 lines in 4 files changed: 15 ins; 0 del; 17 mod
  Patch: https://git.openjdk.org/jdk/pull/26911.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26911/head:pull/26911

PR: https://git.openjdk.org/jdk/pull/26911

Reply via email to