<i18n dev> RFR: 8267670: Update java.io, java.math, and java.text to use switch expressions [v2]
Patrick Concannon
pconcannon at openjdk.java.net
Tue May 25 14:57:28 UTC 2021
On Tue, 25 May 2021 12:43:00 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> Patrick Concannon 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 three additional commits since the last revision:
>>
>> - 8267670: Updated code to use yield
>> - Merge remote-tracking branch 'origin/master' into JDK-8267670
>> - 8267670: Update java.io, java.math, and java.text to use switch expressions
>
> src/java.base/share/classes/java/text/BreakIterator.java line 569:
>
>> 567: case SENTENCE_INDEX -> breakIteratorProvider.getSentenceInstance(locale);
>> 568: default -> null;
>> 569: };
>
> No need to use the local variable `iterator` here. Simply return with the switch expression.
Hi Naoto, thanks for spotting this. Code updated as suggested. See adc8af4
> src/java.base/share/classes/java/text/NumberFormat.java line 982:
>
>> 980: case COMPACTSTYLE -> provider.getCompactNumberInstance(locale, formatStyle);
>> 981: default -> null;
>> 982: };
>
> Same as `BreakIterator`. No need for `numberFormat`.
Code updated as suggested. See adc8af4
-------------
PR: https://git.openjdk.java.net/jdk/pull/4182
More information about the i18n-dev
mailing list