1 Star 1 Fork 0

CS-IMIS-23/20172313yukunpeng

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ArrayIterator.java 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
package srcNo16.TextbookCode.jsjf;
import java.util.*;
public class ArrayIterator<T> extends ArrayList<T> implements Iterator<T>{
int iteratorModCount;
int current;
/**
* Sets up this iterator using the specified modCount.
*/
public ArrayIterator()
{
iteratorModCount = modCount;
current = 0;
}
/**
* Returns true if this iterator has at least one more element
* to deliver in the iteration.
*
* @return true if this iterator has at least one more element to deliver
* in the iteration
* @throws ConcurrentModificationException if the collection has changed
* while the iterator is in use
*/
public boolean hasNext() throws ConcurrentModificationException
{
return super.iterator().hasNext();
}
/**
* Returns the next element in the iteration. If there are no
* more elements in this iteration, a NoSuchElementException is
* thrown.
*
* @return the next element in the iteration
* @throws NoSuchElementException if an element not found exception occurs
* @throws ConcurrentModificationException if the collection has changed
*/
public T next() throws ConcurrentModificationException
{
return super.iterator().next();
}
/**
* The remove operation is not supported in this collection.
*
* @throws UnsupportedOperationException if the remove method is called
*/
public void remove() throws UnsupportedOperationException
{
throw new UnsupportedOperationException();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/CS-IMIS-23/20172313yukunpeng.git
git@gitee.com:CS-IMIS-23/20172313yukunpeng.git
CS-IMIS-23
20172313yukunpeng
20172313yukunpeng
master

搜索帮助