public class EmptyIterator extends java.lang.Object implements Iterator
Modifier and Type | Method and Description |
---|---|
static Iterator |
getInstance()
Returns the singleton EmptyIterator object.
|
boolean |
hasNext()
Checks whether the iterator can scan further.
|
java.lang.Object |
next()
Retrieves the next element in the collection scanned by this
iterator.
|
void |
remove()
Remove the element pointed to by this iterator from the
collection.
|
public static Iterator getInstance()
public boolean hasNext()
hasNext
in interface java.util.Iterator
false
.public java.lang.Object next()
next
in interface java.util.Iterator
java.util.NoSuchElementException
- Always, because the underlying
collection is always empty.public void remove()
remove
in interface java.util.Iterator
java.lang.RuntimeException
- Always, because the underlying
collection is always empty.