Iterator in Java

Iterator is an interface that iterates the elements. It is used to traverse the list and modify the elements. The iterator interface has three methods,
* public boolean hasNext() – This method returns true if the iterator has more elements.
* public object next() – It returns the element and moves the cursor pointer to the next element.
* public void remove() – This method removes the last elements returned by the iterator.