最佳答案
Iterator ite = Set.iterator();
Iterator ite = List.iterator();
ListIterator listite = List.listIterator();
We can use Iterator
to traverse a Set
or a List
or a Map
. But ListIterator
can only be used to traverse a List
, it can't traverse a Set
. Why?
I know that the main difference is that with iterator we can travel in only one direction but with ListIterator
we can travel both directions. Are there any other differences? And any advantages of ListIterator
over Iterator
?