双重Iterator 报错!!!!
Posted 小元子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了双重Iterator 报错!!!!相关的知识,希望对你有一定的参考价值。
1 List list = new ArrayList(); 2 list.add(new String[]{"0","s1","0038","45"}); 3 list.add(new String[]{"0","s2","0038","45"}); 4 list.add(new String[]{"0","s3","0039","45"}); 5 list.add(new String[]{"0","s4","0039","45"}); 6 list.add(new String[]{"0","s5","0039","45"}); 7 Iterator iter = list.iterator(); 8 Iterator iterCompare = list.iterator(); 9 String office_code = ""; 10 String turnId = ""; 11 double money = 0.00; 12 while(iter.hasNext()){ //去掉某个元素只能调用iter.remove()方法。 13 String[] str = (String[]) iter.next(); 14 if("".equals(office_code)){ 15 office_code = str[2]; 16 while(iterCompare.hasNext()){ 17 String[] strCompare = (String[]) iterCompare.next(); 18 if(office_code.equals(strCompare[2])){ 19 money += Double.parseDouble(str[6]); 20 iterCompare.remove(); 21 } 22 } 23 //数据库操作 24 System.out.println(str); 25 money = 0.00;//初始化金额 26 } 27 28 if(office_code.equals(str[2])){//主数据存在就删除 29 iter.remove(); 30 continue; 31 } 32 office_code = "";//要汇总的数据删除完后 33 }
以上是关于双重Iterator 报错!!!!的主要内容,如果未能解决你的问题,请参考以下文章
错误记录Flutter 混合开发获取 BinaryMessenger 报错 ( FlutterActivityAndFragmentDelegate.getFlutterEngine() )(代码片段
springcloud报错-------关于 hystrix 的异常 FallbackDefinitionException:fallback method wasn't found(代码片段
错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段
错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段