On Tue, 25 May 2021 09:37:58 GMT, Patrick Concannon <pconcan...@openjdk.org> wrote:
> Hi, > > Could someone please review my code for updating the code in the `java.io`, > `java.math`, and `java.text` packages to make use of the switch expressions? > > Kind regards, > Patrick 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. 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`. ------------- PR: https://git.openjdk.java.net/jdk/pull/4182