mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +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
|
@ -3791,14 +3791,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||
*/
|
||||
public int compareTo(BigInteger val) {
|
||||
if (signum == val.signum) {
|
||||
switch (signum) {
|
||||
case 1:
|
||||
return compareMagnitude(val);
|
||||
case -1:
|
||||
return val.compareMagnitude(this);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return switch (signum) {
|
||||
case 1 -> compareMagnitude(val);
|
||||
case -1 -> val.compareMagnitude(this);
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
return signum > val.signum ? 1 : -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue