org.openbp.common.util.iterator
Class SingleIterator

java.lang.Object
  extended by org.openbp.common.util.iterator.SingleIterator
All Implemented Interfaces:
java.util.Iterator

public class SingleIterator
extends java.lang.Object
implements java.util.Iterator

This class provides an iterator over a single object. This is useful for Tree-like iterator (as used by CascadeIterator for example). (Composite-pattern)

Author:
Stephan Moritz

Constructor Summary
SingleIterator(java.lang.Object single)
          Creates an enumeration of its argument.
 
Method Summary
 boolean hasNext()
          Have we not yet returned the object.
 java.lang.Object next()
          Return the object if we have not already done so.
 void remove()
          Always throws an UnsupportedOperationException removal is not supported by this iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleIterator

public SingleIterator(java.lang.Object single)
Creates an enumeration of its argument.

Parameters:
single - the object to "iterate" over
Method Detail

hasNext

public boolean hasNext()
Have we not yet returned the object.

Specified by:
hasNext in interface java.util.Iterator
Returns:
if the object is still unreturned

next

public java.lang.Object next()
Return the object if we have not already done so.

Specified by:
next in interface java.util.Iterator
Returns:
the object

remove

public void remove()
Always throws an UnsupportedOperationException removal is not supported by this iterator.

Specified by:
remove in interface java.util.Iterator


Copyright © 2011. All Rights Reserved.