迭代器和listiterator之间的区别 [英] difference between iterator and listiterator

查看:90
本文介绍了迭代器和listiterator之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在Google上找到了迭代器和listiterator之间的区别,

1)迭代器,我们只能向前迭代.

2)listiterator沿任一方向遍历列表

你能不能在罐子里解释一下..和..中的修改点?

遍历时如何在迭代器或列表迭代器中进行修改?.

给出更多一点..?

Hi
i Google and find the difference between iterator and listiterator ,

1) Iterator we can iterate only in forward direction.

2) listiterator traverse the list in either direction

can you please explain in can about modification point in both ..?

can we do modification in iterator or listiterator while transversing..?

give some more point..?

推荐答案

在这两种类型中,您都可以删除最后检索到的元素.
使用ListIterator,您还可以替换最后一个项目.

您更改基础集合的行为是不确定的.

请参见此处 [此处 [
In both type you can remove the last element retrieved.
With the ListIterator, you can also replace the last item.

The behaviour should you change the underlying collection is undefined.

See here[^] and here[^]


这篇关于迭代器和listiterator之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆