net.sf.beanlib.util.concurrent
Class LinkedBlockingDeque.AbstractItr

java.lang.Object
  extended by net.sf.beanlib.util.concurrent.LinkedBlockingDeque.AbstractItr
All Implemented Interfaces:
Iterator<E>
Direct Known Subclasses:
LinkedBlockingDeque.DescendingItr, LinkedBlockingDeque.Itr
Enclosing class:
LinkedBlockingDeque<E>

private abstract class LinkedBlockingDeque.AbstractItr
extends Object
implements Iterator<E>

Base class for Iterators for LinkedBlockingDeque


Field Summary
private  LinkedBlockingDeque.Node<E> lastRet
          Node returned by most recent call to next.
(package private)  LinkedBlockingDeque.Node<E> next
          The next node to return in next
(package private)  E nextItem
          nextItem holds on to item fields because once we claim that an element exists in hasNext(), we must return item read under lock (in advance()) even if it was in the process of being removed when hasNext() was called.
 
Constructor Summary
LinkedBlockingDeque.AbstractItr()
           
 
Method Summary
(package private) abstract  void advance()
          Advances next, or if not yet initialized, sets to first node.
 boolean hasNext()
           
 E next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

next

LinkedBlockingDeque.Node<E> next
The next node to return in next


nextItem

E nextItem
nextItem holds on to item fields because once we claim that an element exists in hasNext(), we must return item read under lock (in advance()) even if it was in the process of being removed when hasNext() was called.


lastRet

private LinkedBlockingDeque.Node<E> lastRet
Node returned by most recent call to next. Needed by remove. Reset to null if this element is deleted by a call to remove.

Constructor Detail

LinkedBlockingDeque.AbstractItr

LinkedBlockingDeque.AbstractItr()
Method Detail

advance

abstract void advance()
Advances next, or if not yet initialized, sets to first node. Implemented to move forward vs backward in the two subclasses.


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>