info.aduna.iteration
Class DistinctIteration<E,X extends Exception>

java.lang.Object
  extended by info.aduna.iteration.CloseableIterationBase<E,X>
      extended by info.aduna.iteration.IterationWrapper<E,X>
          extended by info.aduna.iteration.FilterIteration<E,X>
              extended by info.aduna.iteration.DistinctIteration<E,X>
All Implemented Interfaces:
CloseableIteration<E,X>, Iteration<E,X>
Direct Known Subclasses:
DistinctIterator

public class DistinctIteration<E,X extends Exception>
extends FilterIteration<E,X>

An Iteration that filters any duplicate elements from an underlying iterator.


Field Summary
 
Fields inherited from class info.aduna.iteration.IterationWrapper
wrappedIter
 
Fields inherited from class info.aduna.iteration.CloseableIterationBase
logger
 
Constructor Summary
DistinctIteration(Iteration<? extends E,? extends X> iter)
          Creates a new DistinctIterator.
 
Method Summary
protected  boolean accept(E object)
          Returns true if the specified object hasn't been seen before.
protected  void handleClose()
          Closed this Iteration and also closes the wrapped Iteration if it is a CloseableIteration.
 
Methods inherited from class info.aduna.iteration.FilterIteration
hasNext, next
 
Methods inherited from class info.aduna.iteration.IterationWrapper
remove
 
Methods inherited from class info.aduna.iteration.CloseableIterationBase
close, isClosed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistinctIteration

public DistinctIteration(Iteration<? extends E,? extends X> iter)
Creates a new DistinctIterator.

Parameters:
iter - The underlying iterator.
Method Detail

accept

protected boolean accept(E object)
Returns true if the specified object hasn't been seen before.

Specified by:
accept in class FilterIteration<E,X extends Exception>
Parameters:
object - The object to be tested.
Returns:
true if the object should be returned, false otherwise.

handleClose

protected void handleClose()
                    throws X extends Exception
Description copied from class: IterationWrapper
Closed this Iteration and also closes the wrapped Iteration if it is a CloseableIteration.

Overrides:
handleClose in class FilterIteration<E,X extends Exception>
Throws:
X
X extends Exception


Copyright © 1997-2008 Aduna. All Rights Reserved.