java.util.NoSuchElementException
来源:互联网 发布:mac安全性与隐私 编辑:程序博客网 时间:2024/06/10 01:43
long totaltime=0;
long calltime=System.currentTimeMillis();
System.out.println("println1:"+calltime);
Set<String> words=new HashSet<String>();
words.add("sour");
words.add("sweet");
words.add("bitter");
words.add("spicy");
Iterator<String> witer=words.iterator();
for(int i=0;i<20;i++)
{
System.out.println(witer.next());
}
long calltime2=System.currentTimeMillis();
System.out.println("calltime2:"+calltime2);
totaltime=calltime2-calltime;
long calltime=System.currentTimeMillis();
System.out.println("println1:"+calltime);
Set<String> words=new HashSet<String>();
words.add("sour");
words.add("sweet");
words.add("bitter");
words.add("spicy");
Iterator<String> witer=words.iterator();
for(int i=0;i<20;i++)
{
System.out.println(witer.next());
}
long calltime2=System.currentTimeMillis();
System.out.println("calltime2:"+calltime2);
totaltime=calltime2-calltime;
System.out.println("totaltime:"+totaltime);
很简单的一段代码 ,什么原因报java.util.NoSuchElementException??
---这类的异常表明 表明枚举中没有更多的元素。
ok结果出来了 因为集合中只有4个元素,而循环了20;超过了长度。
--修改为i<4 之后 输出结果如下:
println1:1417432431871
sour
sweet
spicy
bitter
calltime2:1417432431872
totaltime:1
0 0
- java.util.NoSuchElementException翻译
- java.util.NoSuchElementException原因
- java.util.NoSuchElementException
- java.util.NoSuchElementException
- java.util.NoSuchElementException
- java.util.NoSuchElementException
- java.util.NoSuchElementException
- java.util.NoSuchElementException
- java.util.NoSuchElementException异常
- java.util.NoSuchElementException
- java.util.NoSuchElementException
- 错误记录--java.util.NoSuchElementException
- 关于java.util.NoSuchElementException错误
- java.util.NoSuchElementException错误 解决办法
- java.util.NoSuchElementException: Hashtable Enumerator
- Iterator错误:java.util.NoSuchElementException
- 解决sqoop java.util.NoSuchElementException
- 解决sqoop java.util.NoSuchElementException
- RequestMethod.DELETE RequestMethod.PUT 这些类型是什么时候使用。
- MTK F&Q
- 你第一要做的是开始去做
- 完全重新初始化vs2013
- effective C++ 读书笔记 条款12与条款13
- java.util.NoSuchElementException
- android 从相册中选择图片并判断图片是否旋转
- IOS 升级78 AutoLayout 概述 (二)
- Copy file to / from server via SCP command
- c++类的构造函数详解
- makefile详解 make 的运行
- nyist oj 1172 unlucky number
- 事务与锁(转)
- [Objective-C]关联(objc_setAssociatedObject、objc_getAssociatedObject、objc_removeAssociatedObjects)