I read the following in Data Structures and Algorithms by Goodrich :
Java provides an iterator through its java.util.Iterator interface. We
note that the java.util.Scanner class (Section 1.6) implements this
interface. This interface supports an additional (optional) method to
remove the previously returned element from the collection. This
functionality (removing elements through an iterator) is somewhat
controversial from an object-oriented viewpoint, however, and it is
not surprising that its implementation by classes is optional
I don’t understand what the author is referring to here. Which is the method in discussion here and what does it do?
The
remove()method will delete the element that was most recently returned fromnext().