Java???????????????е??????
???????????? ???????[ 2013/1/31 11:08:49 ] ????????
????Debug???????????????????????????????size???С????????????????
????????????????????????С?????????????
???????????????for????????????????????????????????size???С?????????????????????????????δ???????
ArrayList<Integer> a=new ArrayList<Integer>(15);
a.add(222);
a.add(3);
a.add(333);
a.add(000);
a.add(333);
a.add(4);
for(int s=a.size()-1;s>=0;s--){
if(a.get(s).intValue()==333){
a.remove(s);
}
}
???????????????Iterator??remove()????????????е????
??????JDK????Iterator?????????????????remove??????
????remove
????void remove()
??????????????? collection ?????????????????????????????????????ε??? next ????????δ????????????е????????????????????????????????????????? collection???????????????????????
?????????
????UnsupportedOperationException - ?????????????? remove ??????
????IllegalStateException - ?????δ???? next ????????????????ε??? next ???????????????? remove ??????
/**
*@paramsource
*@paramblackNameList
*/
privatevoid screenBlackNameList(List<SharedBoardSmsWrapper> source?? List<BlackNameListModel> blackNameList){
Iterator<SharedBoardSmsWrapper> sourceIt=source.iterator();
while(sourceIt.hasNext()){
SharedBoardSmsWrapper tmpSharedBoardSmsWrapper=sourceIt.next();
Iterator<BlackNameListModel> blackNameListIt=blackNameList.iterator();
while(blackNameListIt.hasNext()){
BlackNameListModel tmpBlackNameListModel=blackNameListIt.next();
if(tmpSharedBoardSmsWrapper.getSource().equals(tmpBlackNameListModel.getSource())){
sourceIt.remove();
break;
}
}
}
}
/** *@paramsource *@paramblackNameList */ privatevoid screenBlackNameList(List<SharedBoardSmsWrapper> source?? List<BlackNameListModel> blackNameList){ Iterator<SharedBoardSmsWrapper> sourceIt=source.iterator(); while(sourceIt.hasNext()){ SharedBoardSmsWrapper tmpSharedBoardSmsWrapper=sourceIt.next(); Iterator<BlackNameListModel> blackNameListIt=blackNameList.iterator(); while(blackNameListIt.hasNext()){ BlackNameListModel tmpBlackNameListModel=blackNameListIt.next(); if(tmpSharedBoardSmsWrapper.getSource().equals(tmpBlackNameListModel.getSource())){ sourceIt.remove(); break; } } } }
??????????Iterator??next()???????????ε???remove()??????????????????
??????
???·???
??????????????????
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