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
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…