mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
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:
parent
f5634fe39d
commit
4eb216824f
11 changed files with 161 additions and 349 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue