try {
for (int i = 1; i <= list.size(); i++) {
String parameter = list.get(i - 1).trim();
switch (i) {
case 6:
scripBO.setErrorCode(Short.parseShort(parameter));
break;
case 7:
scripBO.setBcSeqNo(Long.parseLong(parameter));
break;
case 12:
scripBO.setMsgCount(Long.parseLong(parameter));
msgcount= scripBO.getMsgCount();
break;
case 13:
case 16:
case 19:
case 22:
case 25:
case 28:
case 31:
case 34:
case 37:
case 40:
case 43:
case 46: // and multiple cases..
tokenval = scripBO.setTokenNumber(Long.parseLong(parameter));
break;
答案 0 :(得分:0)
您要处理的第三个数字都是从13开始。如果要减少.flatMap()
语句的数量,可以在case
之外创建一个if
来处理这些数字:>
switch