org.omnaest.utils.structure.iterator.decorator
Class IteratorDecorator<E>

java.lang.Object
  extended by org.omnaest.utils.structure.iterator.decorator.IteratorDecorator<E>
Type Parameters:
E -
All Implemented Interfaces:
Iterator<E>
Direct Known Subclasses:
LockingIteratorDecorator

public class IteratorDecorator<E>
extends Object
implements Iterator<E>

An IteratorDecorator decorates an existing Iterator instance. If it is subclassed method invocations can be intercepted by overriding the respective methods.

Author:
Omnaest

Field Summary
protected  Iterator<E> iterator
           
 
Constructor Summary
IteratorDecorator(Iterator<E> iterator)
           
 
Method Summary
protected  Iterator<E> getIterator()
           
 boolean hasNext()
           
 E next()
           
 void remove()
           
protected  void setIterator(Iterator<E> iterator)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

iterator

protected Iterator<E> iterator
Constructor Detail

IteratorDecorator

public IteratorDecorator(Iterator<E> iterator)
Parameters:
iterator -
See Also:
IteratorDecorator
Method Detail

getIterator

protected Iterator<E> getIterator()
Returns:
the iterator

setIterator

protected void setIterator(Iterator<E> iterator)
Parameters:
iterator - the iterator to set

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<E>
Returns:
See Also:
Iterator.hasNext()

next

public E next()
Specified by:
next in interface Iterator<E>
Returns:
See Also:
Iterator.next()

remove

public void remove()
Specified by:
remove in interface Iterator<E>
See Also:
Iterator.remove()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.