SpringBoot项目中关于迭代器Interator中重复使用next()的未知错误
利用迭代器取出List中的Map的value,重复使用iterator.next()代码报错,原因未知。
Integer key =(Integer)iterator.next()报错:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.util.NoSuchElementException] with root cause
删除该行代码,只保留一处iterator.next(),程序运行正常
未知原因,求解!!