我只是不知道是什么问题,为什么这段代码会抛出 java.util.NoSuchElementException 因为在调用下一个方法之前有 hasNext
Map results = getResults();
if (results != null)
{
Set set = results.entrySet();
Iterator it = set.iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Iterator jt = ((Collection) entry.getValue()).iterator();
while (jt.hasNext()) {
CustomException e = (CustomException) jt.next();
String exp = e.getMessage();
exp = (exp == null)?"":exp;
if(!"".equals(exp) && !exp.contains("errors"))
{
setError(exp)
}
}
}
}