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. > On May 25, 2021, at 7:57 AM, Patrick Concannon <pconcan...@openjdk.java.net> > 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 > > ------------- > > Commit messages: > - 8267670: Update java.io, java.math, and java.text to use switch expressions > > Changes: https://git.openjdk.java.net/jdk/pull/4182/files > Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4182&range=00 > Issue: https://bugs.openjdk.java.net/browse/JDK-8267670 > Stats: 328 lines in 11 files changed: 1 ins; 187 del; 140 mod > Patch: https://git.openjdk.java.net/jdk/pull/4182.diff > Fetch: git fetch https://git.openjdk.java.net/jdk pull/4182/head:pull/4182 > > PR: https://git.openjdk.java.net/jdk/pull/4182