On Tue, 30 Sep 2025 23:21:32 GMT, Shaojin Wen <[email protected]> wrote:

>> The DateTimeFormatterBuilder::FIELD_MAP previously used a Map<Character, 
>> TemporalField> for mapping pattern characters to TemporalField
>> instances. This PR refactors that implementation to use a switch expression 
>> instead, which eliminates the need to hold a Map in
>> memory.
>> 
>> The switch expression approach offers these advantages:
>> - No memory overhead for maintaining a HashMap structure
>> - More direct character-to-field mapping without hash computation
>> - Better code readability and maintainability
>> 
>> This change maintains the same functionality while improving the memory 
>> efficiency of pattern character lookup in
>> DateTimeFormatterBuilder by eliminating the static Map that was previously 
>> used for character-to-field mapping.
>> 
>> * before
>> <img width="2018" height="1016" alt="image" 
>> src="https://github.com/user-attachments/assets/57d4c513-55c7-472e-95a8-9f7a4b47662d";
>>  />
>
> Shaojin Wen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   revert comment @liach

Marked as reviewed by naoto (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/26634#pullrequestreview-3289923824

Reply via email to