今天在高级for循环中用了一下remove发现报错,写了个demo测试看:
List<String> a = new ArrayList<String>();
a.add("1");
a.add("2");
for (String temp : a) {
if("1".equals(temp)){
a.remove(temp);
} }
此时代码是没有问题的,运行正常;但是把”1”.equa
今天在高级for循环中用了一下remove发现报错,写了个demo测试看:
List<String> a = new ArrayList<String>();
a.add("1");
a.add("2");
for (String temp : a) {
if("1".equals(temp)){
a.remove(temp);
} }
此时代码是没有问题的,运行正常;但是把”1”.equa