JavaIterator Interface
Iterator Methods
TheIterator interface provides methods to access and iterate through collections:
| Method | Description | Return Type |
|---|---|---|
| hasNext() | Returns true if there are more elements in the iteration | boolean |
| next() | Returns the next element in the iteration | T |
| remove() | Removes the last element returned by next() | void |
Note: Thenext() method uses the type of the iterator's items as its return value. This type is referred to asT in the table.

