This is just an auto-conversion to use a switch expression to initialize
initial index.
Change-Id: Ic7ed21aef2cf6a4c20733f0400163bfbf25c3a9e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
// Deal with optional sign
final boolean negative;
// Deal with optional sign
final boolean negative;
- int idx;
- switch (str.charAt(0)) {
- case '-':
+ int idx = switch (str.charAt(0)) {
+ case '-' -> {
- idx = 1;
- break;
- case '+':
+ yield 1;
+ }
+ case '+' -> {
- idx = 1;
- break;
- default:
+ yield 1;
+ }
+ default -> {
// Sanity check length
if (idx == str.length()) {
return CanonicalValueViolation.variantOf("Missing digits after sign");
// Sanity check length
if (idx == str.length()) {
return CanonicalValueViolation.variantOf("Missing digits after sign");