java.util.NoSuchElementException错误 解决办法
2013-05-12 12:38
375 查看
Iterator iter = list.iterator();
while(iter.hasNext()){
System.out.println( ((Resource)iter.next()).getChineseName() + "=" + ((Resource)iter.next()).getEnglishName() );
}
报错如下图所示:
主要由于我们在循环中使用了两次的next()方法,所以只用一个next()方法即可。
while(iter.hasNext()){
System.out.println( ((Resource)iter.next()).getChineseName() + "=" + ((Resource)iter.next()).getEnglishName() );
}
报错如下图所示:
主要由于我们在循环中使用了两次的next()方法,所以只用一个next()方法即可。
相关文章推荐
- java.util.NoSuchElementException解决办法
- java.util.NoSuchElementException解决办法
- java.util.NoSuchElementException解决办法
- java.util.NoSuchElementException:Hashtable Enumerator 解决办法
- java.util.NoSuchElementException解决办法
- 关于java.util.NoSuchElementException错误的一则例子
- 解决:Redis:java.util.NoSuchElementException: Unable to validate object at
- 迭代器(Iterator)的java.util.NoSuchElementException错误的改正
- Iterator迭代器导致的java.util.NoSuchElementException原因与解决方法
- "java.util.NoSuchElementException: No value present" 问题解决:重写hashCode 和 equals 方法
- 解决sqoop java.util.NoSuchElementException
- Iterator错误:java.util.NoSuchElementException
- Android编程:解决异常“java.util.NoSuchElementException”
- 错误 java.util.NoSuchElementException:Hashtable Enumerator
- 解决sqoop java.util.NoSuchElementException
- JAVA Scanner 用法注意事项(scanner 使用错误:Exception in thread "main" java.util.NoSuchElementExceptionation )
- 关于java.util.NoSuchElementException错误
- 不经意间犯得一个java.util.NoSuchElementException的错误
- 【JAVA学习】Iterator迭代器导致的java.util.NoSuchElementException原因与解决方法
- 错误记录--java.util.NoSuchElementException