java.lang.Object
org.cantaloop.tools.collection.SingleElementIterator
- All Implemented Interfaces:
- java.util.Iterator
- public class SingleElementIterator
- extends java.lang.Object
- implements java.util.Iterator
|
Method Summary |
boolean |
hasNext()
Tests whether there are elements remaining in the collection. |
java.lang.Object |
next()
Obtain the next element in the collection. |
void |
remove()
Remove from the underlying collection the last element returned by next
(optional operation). |
void |
setElement(java.lang.Object obj)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_obj
private java.lang.Object m_obj
m_seen
private boolean m_seen
m_objSet
private boolean m_objSet
SingleElementIterator
public SingleElementIterator()
SingleElementIterator
public SingleElementIterator(java.lang.Object obj)
setElement
public void setElement(java.lang.Object obj)
hasNext
public boolean hasNext()
- Description copied from interface:
java.util.Iterator
- Tests whether there are elements remaining in the collection. In other
words, calling
next() will not throw an exception.
- Specified by:
hasNext in interface java.util.Iterator
next
public java.lang.Object next()
- Description copied from interface:
java.util.Iterator
- Obtain the next element in the collection.
- Specified by:
next in interface java.util.Iterator
remove
public void remove()
- Description copied from interface:
java.util.Iterator
- Remove from the underlying collection the last element returned by next
(optional operation). This method can be called only once after each
call to
next(). It does not affect what will be returned
by subsequent calls to next.
- Specified by:
remove in interface java.util.Iterator