cutthecrap.utils.striterators
Class SingleValueIterator<E>
java.lang.Object
cutthecrap.utils.striterators.SingleValueIterator<E>
- All Implemented Interfaces:
- ICloseableIterator<E>, Iterator<E>
public class SingleValueIterator<E>
- extends Object
- implements ICloseableIterator<E>
SingleValueIterator
Only one value but need to return an iterator? This makes it easy.
|
Method Summary |
void |
close()
Closes the iterator, releasing any associated resources. |
boolean |
hasNext()
|
E |
next()
|
void |
remove()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SingleValueIterator
public SingleValueIterator(E value)
hasNext
public boolean hasNext()
- Specified by:
hasNext in interface Iterator<E>
next
public E next()
- Specified by:
next in interface Iterator<E>
remove
public void remove()
- Specified by:
remove in interface Iterator<E>
close
public void close()
- Description copied from interface:
ICloseableIterator
- Closes the iterator, releasing any associated resources. This method MAY
be invoked safely if the iterator is already closed. Implementations of
this interface MUST invoke
ICloseableIterator.close() if Iterator.hasNext()
method returns false to ensure that the iterator is closed
(and its resources release) as soon as it is exhausted.
Note: Implementations that support Iterator.remove() MUST NOT
eagerly close the iterator when it is exhausted since that would make it
impossible to remove the last visited statement. Instead they MUST wait
for an explicit ICloseableIterator.close() by the application.
- Specified by:
close in interface ICloseableIterator<E>
Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.