| java.lang.Object org.apache.commons.collections.iterators.SingletonIterator
SingletonIterator | public class SingletonIterator implements Iterator,ResettableIterator(Code) | | SingletonIterator is an
Iterator over a single
object instance.
since: Commons Collections 2.0 version: $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $ author: James Strachan author: Stephen Colebourne author: Rodney Waldhoff |
Constructor Summary | |
public | SingletonIterator(Object object) Constructs a new SingletonIterator where remove
is a permitted operation. | public | SingletonIterator(Object object, boolean removeAllowed) Constructs a new SingletonIterator optionally choosing if
remove is a permitted operation. |
Method Summary | |
public boolean | hasNext() Is another object available from the iterator?
This returns true if the single object hasn't been returned yet. | public Object | next() Get the next object from the iterator. | public void | remove() Remove the object from this iterator. | public void | reset() Reset the iterator to the start. |
SingletonIterator | public SingletonIterator(Object object)(Code) | | Constructs a new SingletonIterator where remove
is a permitted operation.
Parameters: object - the single object to return from the iterator |
SingletonIterator | public SingletonIterator(Object object, boolean removeAllowed)(Code) | | Constructs a new SingletonIterator optionally choosing if
remove is a permitted operation.
Parameters: object - the single object to return from the iterator Parameters: removeAllowed - true if remove is allowed since: Commons Collections 3.1 |
hasNext | public boolean hasNext()(Code) | | Is another object available from the iterator?
This returns true if the single object hasn't been returned yet.
true if the single object hasn't been returned yet |
next | public Object next()(Code) | | Get the next object from the iterator.
This returns the single object if it hasn't been returned yet.
the single object throws: NoSuchElementException - if the single object has already been returned |
remove | public void remove()(Code) | | Remove the object from this iterator.
throws: IllegalStateException - if the next method has notyet been called, or the remove method has alreadybeen called after the last call to the nextmethod. throws: UnsupportedOperationException - if remove is not supported |
reset | public void reset()(Code) | | Reset the iterator to the start.
|
|
|