我正在寻找一种使用单个开关处理两个字符串的方法,我认为这在 Java 中是不可能的。
这是一些我只想通过开关实现的伪代码。
int s1Value = 0;
int s2Value = 0;
String s1 = "a";
String s2 = "g";
switch (s1 || s2) {
case "a": s1value = 0; s2value = 0; break;
case "b": s1value = 1; s2value = 1; break;
case "c": s1value = 2; s2value = 2; break;
case "d": s1value = 3; s2value = 3; break;
case "e": s1value = 4; s2value = 4; break;
case "f": s1value = 5; s2value = 5; break;
case "g": s1value = 6; s2value = 6; break;
}