[code="java"]if(name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name")||name.equals("name"))
switch (name) {
case "name":
break;
case "name":
break;
case "name":
break;
case "name":
break;
case "name":
break;
case "name":
break;
case "name":
break;
case "name":
break;
case "name":
break;
case "name":
break;
case "name":
break;
case "name":
break;
case "name":
break;
case "name":
break;
}
}[/code]
我现在前台有很多种name值,大概有60多个不同name,每个name既可以对应不同值也可以多name值组合成一个值。
我现在一个方法中条件语句判断用了大概40多个变量来判断,但是这样用if else 来判断性能显得不高。大家有什么好的方法替代if else 吗?