org.omnaest.utils.structure.iterator
Class ThreadSafeIterator<E>

java.lang.Object
  extended by org.omnaest.utils.structure.iterator.ThreadSafeIterator<E>
Type Parameters:
E -
All Implemented Interfaces:
Iterator<E>

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

Thread safe Iterator delegate which makes use of an internal ReentrantLock to avoid concurrent access of the underlying Iterator.

Author:
Omnaest

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

Constructor Detail

ThreadSafeIterator

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

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<E>

next

public E next()
Specified by:
next in interface Iterator<E>

remove

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


Copyright © 2013. All Rights Reserved.