On Wed, 26 May 2021 09:05:34 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 > > Patrick Concannon has updated the pull request incrementally with one > additional commit since the last revision: > > 8267670: Removed trailing whitespace > _Mailing list message from [Brian Goetz](mailto:brian.go...@oracle.com) on > [core-libs-dev](mailto:core-libs-...@mail.openjdk.java.net):_ > > In the last hunk, you convert > > case Collator.IDENTICAL: toAddTo.append('='); break; > case Collator.TERTIARY: toAddTo.append(','); break; > case Collator.SECONDARY: toAddTo.append(';'); break; > case Collator.PRIMARY: toAddTo.append('<'); break; > case RESET: toAddTo.append('&'); break; > case UNSET: toAddTo.append('?'); break; > > to > > case Collator.IDENTICAL -> toAddTo.append('='); > case Collator.TERTIARY -> toAddTo.append(','); > case Collator.SECONDARY -> toAddTo.append(';'); > case Collator.PRIMARY -> toAddTo.append('<'); > case RESET -> toAddTo.append('&'); > case UNSET -> toAddTo.append('?'); > > But, you can go further, pulling the toAddTo.append() call out of the switch. > This was one of the benefits we anticipated with expression switches; that it > would expose more opportunities to push the conditional logic farther down > towards the leaves. I suspect there are other opportunities for this in this > patch too. Hi Brian, Thanks for your suggestion. I've incorporated it into the PR, and you can find it in commit e503ed2 ------------- PR: https://git.openjdk.java.net/jdk/pull/4182