List Iterator in Java | Java Collections | Collection Framework | Java Tutorial For Beginners

preview_player
Показать описание
Please use the following link to install the Katalon Studio:

ListIterator:

Cursors are used to get the elements one by one from the Collection.
So, ListIterator is to get the elements one by one from the Collection.
With the help of ListIterator, can perform ADD, READ, REPLACE and REMOVE operations.
It works in both the directions (i.e., bi-directional).

Methods:
public boolean hasNext(): To verify elements available in the Collection.
public Object next(): To get the next element if it has next element.
public int nextIndex(): To get the index of the next element.
public boolean hasPrevious(): To verify previous elements available in the Collection.
public Object previous(): To get the previous element if it has next element.
public int previousIndex(): To get the index of the previous element.
public void remove(): To remove the element from the Collection
public void set(): To replace the element.
public void add(): To add the new element.

Limitations:
It is applicable for only List objects.

Рекомендации по теме
visit shbcf.ru