On Sat, 23 Aug 2025 04:06:13 GMT, Shaojin Wen <[email protected]> wrote:

> 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.appendLatin1(char c1, char c2)` with core 
> implementation
>    - Added `JavaLangAccess.appendPair(StringBuilder, char c1, char c2)` for 
> internal access
>    - 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.

This pull request has now been integrated.

Changeset: 4ffdf7af
Author:    Shaojin Wen <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/4ffdf7af88f6c0a69663eb249957dbceea3cb697
Stats:     111 lines in 6 files changed: 75 ins; 7 del; 29 mod

8366224: Introduce DecimalDigits.appendPair for efficient two-digit formatting 
and refactor DateTimeHelper

Reviewed-by: liach, rriggs

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

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

Reply via email to