org.apache.commons.collections.iterators

Class SingletonIterator

Implemented Interfaces:
Iterator
Known Direct Subclasses:
SingletonIterator

public class SingletonIterator
extends java.lang.Object
implements Iterator

SingletonIterator is an Iterator over a single object instance.
Version:
$Revision: 1.2.2.1 $
Authors:
James Strachan
Stephen Colebourne
Since:
2.0

Constructor Summary

SingletonIterator(Object object)
Constructs a new SingletonIterator.

Method Summary

boolean
hasNext()
Is another object available from the iterator.
Object
next()
Get the next object from the iterator.
void
remove()
Remove always throws UnsupportedOperationException.

Constructor Details

SingletonIterator

public SingletonIterator(Object object)
Constructs a new SingletonIterator.
Parameters:
object - the single object to return from the iterator

Method Details

hasNext

public boolean hasNext()
Is another object available from the iterator.

This returns true if the single object hasn't been returned yet.

Returns:
true if the single object hasn't been returned yet

next

public Object next()
Get the next object from the iterator.

This returns the single object if it hasn't been returned yet.

Returns:
the single object

remove

public void remove()
Remove always throws UnsupportedOperationException.

Copyright © 2001-2004 Apache Software Foundation. Documenation generated ${TODAY}.