Java???????????????е??????
???????????? ???????[ 2013/1/31 11:08:49 ] ????????
??????????????java??????У?????????????????????????????????в???????????????????????????????????????“Java????????????????е??????”??????
???????????д??????????
????private void screenBlackNameList(List<SharedBoardSmsWrapper> source?? List<BlackNameListModel> blackNameList)
??????????????????source?????б??????Щ??????????????blackNameList?????б????????????б???????????????????????source?????к????????????????????
??????????????????????????
?????????????for each ???????????
for(SharedBoardSmsWrapper tmpSharedBoardSmsWrapper:source){
for(BlackNameListModel tmpBlackNameListModel:blackNameList){
if(tmpSharedBoardSmsWrapper.getSource().equals(tmpBlackNameListModel.getSource())){
source.remove(tmpSharedBoardSmsWrapper);
break;
}
}
}
for(SharedBoardSmsWrapper tmpSharedBoardSmsWrapper:source){ for(BlackNameListModel tmpBlackNameListModel:blackNameList){ if(tmpSharedBoardSmsWrapper.getSource().equals(tmpBlackNameListModel.getSource())){ source.remove(tmpSharedBoardSmsWrapper); break; } } }
??????????????????Ц??
????????…
??????????????????δ????????????
????java.util.ConcurrentModificationException??
??????JDK6???
????public class ConcurrentModificationException
????extends RuntimeException
????????????????????????????????????????????????????
???????磬???????? Collection ????е???????????????????????????? Collection?????????Щ????£??????????????????????????????????Щ?????????????? JRE ??????????? collection ??????????????????????иò???????????????????? ?????????????????????????????????e?????????????????????????????????
???????????????????????????????? ?????????????????????Υ??????Э??????????????У??????????????????????磬?????????????????????? collection ????????????? collection????????????????????
???????????????????????????????????????????????????????????????????????????κ???????????????????????????? ConcurrentModificationException??????????????????????????д???????????????????????????????????? ???ConcurrentModificationException ??y??????? bug??
????Java?е?For each???????????iterator???д???????iterator????????????iterator??????????????????for each????????????????????????????iterator?????ConcurrentModificationException??
????????????????????????for??????
for(int i=0;i<source.size();i++){
SharedBoardSmsWrapper tmpSharedBoardSmsWrapper=source.get(i);
for(int j=0;j<blackNameList.size();j++){
BlackNameListModel tmpBlackNameListModel=blackNameList.get(j);
if(tmpSharedBoardSmsWrapper.getSource().equals(tmpBlackNameListModel.getSource())){
source.remove(tmpSharedBoardSmsWrapper);
break;
}
}
}
for(int i=0;i<source.size();i++){ SharedBoardSmsWrapper tmpSharedBoardSmsWrapper=source.get(i); for(int j=0;j<blackNameList.size();j++){ BlackNameListModel tmpBlackNameListModel=blackNameList.get(j); if(tmpSharedBoardSmsWrapper.getSource().equals(tmpBlackNameListModel.getSource())){ source.remove(tmpSharedBoardSmsWrapper); break; } } }
????????????????????????????????2???…
?????Σ???????£????????????ò????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11