switch
嵌套的 switch 语句可能导致代码格外混乱。 这些语句可以提取到一个单独的方法中。
示例:
int res = switch (i) { case 0 -> 0; default -> switch (i) { case 100 -> 0; default -> i; }; };