多次iterator.next()导致迭代器越界,应该先取出来,再判断
Iterator<DownUrlEntity> iterator = req.iterator();
while (iterator.hasNext()){
if (iterator.next().getId() == null) {
if (!"".equals(iterator.next().getCode()) && !"".equals(iterator.next().getUrl())) {
iterator.next().setCreateTime(new Date());
if (downUrlService.save(iterator.next())) {
iterator.remove();
}
}
}
}
网友评论