Iterator ite = Set.iterator();
Iterator ite = List.iterator();
ListIterator listite = List.listIterator();
Run Code Online (Sandbox Code Playgroud)
我们可以Iterator用来遍历一个Set或一个List或一个Map.但是ListIterator只能用来遍历一个List,它不能遍历一个Set.为什么?
我知道主要区别在于,使用迭代器,我们只能朝一个方向行进,但ListIterator我们可以向两个方向行进.还有其他差异吗?ListIterator超过任何优势Iterator?