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.

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

Commit messages:
 - Optimize year formatting in DateTimeHelper by reducing modulo operation
 - Refactor DateTimeHelper to use DecimalDigits.appendPair for date/time 
formatting\n\nThis change updates DateTimeHelper.formatTo methods for LocalDate 
and LocalTime\nto use the new DecimalDigits.appendPair method for formatting 
month, day, hour,\nminute, and second components. This improves code clarity 
and leverages the\nnewly introduced efficient two-digit integer appending 
functionality.
 - Introduce appendPair method for efficient two-digit integer 
appending\n\nThis change adds a new internal API to efficiently append 
two-digit integers\n(00-99) to a StringBuilder. It includes:\n- 
AbstractStringBuilder.appendPair(int i): The core implementation.\n- 
JavaLangAccess.appendPair(StringBuilder, int): For internal access.\n- 
System.JavaLangAccessImpl.appendPair(StringBuilder, int): Bridge to 
AbstractStringBuilder.\n- DecimalDigits.appendPair(StringBuilder, int): Public 
static utility method.\n\nImproved Javadoc comments for clarity and consistency 
across all new methods.

Changes: https://git.openjdk.org/jdk/pull/26911/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26911&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8366224
  Stats: 83 lines in 5 files changed: 69 ins; 4 del; 10 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