org.openbp.common.util.iterator
Class DoubleSafeIterator

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

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

This class symbols an iterator that insures that similar objects are returned only once.

Author:
Stephan Moritz

Constructor Summary
DoubleSafeIterator(java.util.Iterator base)
          Creates a new DoubleSafeIterator around a given one.
 
Method Summary
 boolean hasNext()
          Returns whether there are any more elements.
 java.lang.Object next()
          Returns the next element
 void remove()
          Always throws an UnsupportedOperationException removal is not supported by this iterator.
protected  void skipAhead()
          Advances internal counter, skipping doublettes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleSafeIterator

public DoubleSafeIterator(java.util.Iterator base)
Creates a new DoubleSafeIterator around a given one.

Parameters:
base - the iterator to wrap
Method Detail

hasNext

public boolean hasNext()
Returns whether there are any more elements.

Specified by:
hasNext in interface java.util.Iterator
Returns:
true if there are objects left

next

public java.lang.Object next()
Returns the next element

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

remove

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

Specified by:
remove in interface java.util.Iterator

skipAhead

protected void skipAhead()
Advances internal counter, skipping doublettes.



Copyright © 2011. All Rights Reserved.