8267670: Update java.io, java.math, and java.text to use switch expressions

Reviewed-by: darcy, chegar, naoto, iris, dfuchs, lancea, vtewari
This commit is contained in:
Patrick Concannon 2021-06-01 10:14:56 +00:00
parent f5634fe39d
commit 4eb216824f
11 changed files with 161 additions and 349 deletions

View file

@ -130,14 +130,18 @@ class PatternEntry {
if (showWhiteSpace)
toAddTo.append(' ');
}
switch (strength) {
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;
}
var c = switch (strength) {
case Collator.IDENTICAL -> '=';
case Collator.TERTIARY -> ',';
case Collator.SECONDARY -> ';';
case Collator.PRIMARY -> '<';
case RESET -> '&';
case UNSET -> '?';
default -> throw new IllegalStateException("Unexpected value: " + strength);
};
toAddTo.append(c);
if (showWhiteSpace)
toAddTo.append(' ');
appendQuoted(chars,toAddTo);