我试图从两个排序列表中创建排名。
List<Ordered<String>> rankedList = Collections.synchronizedList(WebCBIR.run(queryData, clusters, idf));
List<Ordered<String>> rankedList2 = Collections.synchronizedList(WebCBIR.run(queryData, clusters));
LinkedList<Ordered<String>> result = new LinkedList<>();
Iterator<Ordered<String>> it = rankedList.iterator();
Iterator<Ordered<String>> it2 = rankedList2.iterator();
while (it.hasNext() && it2.hasNext()) {
Ordered<String> o1 = it.next();
Ordered<String> o2 = it2.next();
Ordered<String> o = null;
if(o1.value() > o2.value()){
o = o1;
rankedList.remove(o);
rankedList2.remove(o);
}
else{
o = o2;
rankedList.remove(o);
rankedList2.remove(o);
}
result.add(o);
}
此代码调用 java.util.ConcurrentModificationException。如何处理?