mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
IDEA-142912 (Intention: replace switch with if failed with bit operator (operator precedence))
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace 'switch' with 'if'" "true"
|
||||
class Precedence {
|
||||
|
||||
void m() {
|
||||
int a = 10;
|
||||
if ((a & 1) == 0) {
|
||||
System.out.println("0");
|
||||
|
||||
} else if ((a & 1) == 1) {
|
||||
System.out.println("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace 'switch' with 'if'" "true"
|
||||
class Precedence {
|
||||
|
||||
void m() {
|
||||
int a = 10;
|
||||
switch<caret>(a & 1) {
|
||||
case 0:
|
||||
System.out.println("0");
|
||||
break;
|
||||
case 1:
|
||||
System.out.println("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user