private void screenBlackNameList(List<SharedBoardSmsWrapper> source, List<BlackNameListModel> blackNameList)
for(SharedBoardSmsWrapper tmpSharedBoardSmsWrapper:source){
for(BlackNameListModel tmpBlackNameListModel:blackNameList){
if(tmpSharedBoardSmsWrapper.getSource().equals(tmpBlackNameListModel.getSource())){
source.remove(tmpSharedBoardSmsWrapper);
break;
}
}
}
public class ConcurrentModificationException extends RuntimeException
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;
}
}
}
void 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;
}
}
}
}
privateclass Itr implements Iterator<E> {
/**
这是元素的索引,相当于一个指针,或者游标,利用它来访问List的数据元素。
*Indexofelementtobereturnedbysubsequentcalltonext.
*/
intcursor = 0;
/**
*Indexofelementreturnedbymostrecentcalltonextor
*previous. Resetto-1ifthiselementisdeletedbyacall
*toremove.
最新元素的索引。如果已经删除了该元素,就设为-1
*/
intlastRet = -1;
/**
外部类ArrayList的属性:
protected transient int modCount = 0;
它用于观察ArrayList是否同时在被其他线程修改,如果不一致,那么就会抛出同步异常。
*ThemodCountvaluethattheiteratorbelievesthatthebacking
*Listshouldhave. Ifthisexpectationisviolated,theiterator
*hasdetectedconcurrentmodification.
*/
intexpectedModCount = modCount;
//如果游标没有达到List的尺寸,那么就还有元素。
publicboolean hasNext() {
returncursor != size();
}
//返回当前元素,然后游标+1。最近索引 也= 返回的元素的索引。
public E next() {
checkForComodification();
try {
E next = get(cursor);
lastRet = cursor++;
return next;
} catch (IndexOutOfBoundsException e) {
checkForComodification();
thrownew NoSuchElementException();
}
}
/*
删除元素,就是删除当前元素,并且把游标-1。因为,List会把后面的元素全部移前一位。
*/
publicvoid remove() {
if (lastRet == -1)
thrownew IllegalStateException();
checkForComodification();
try {
AbstractList.this.remove(lastRet);
if (lastRet < cursor)
cursor--;
lastRet = -1;
expectedModCount = modCount;
} catch (IndexOutOfBoundsException e) {
thrownew ConcurrentModificationException();
}
}
finalvoid checkForComodification() {
if (modCount != expectedModCount)
thrownew ConcurrentModificationException();
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有