Class LinkedBlockingDeque.AbstractItr
- java.lang.Object
-
- org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.LinkedBlockingDeque.AbstractItr
-
- All Implemented Interfaces:
java.util.Iterator<E>
- Direct Known Subclasses:
LinkedBlockingDeque.DescendingItr
,LinkedBlockingDeque.Itr
- Enclosing class:
- LinkedBlockingDeque<E>
private abstract class LinkedBlockingDeque.AbstractItr extends java.lang.Object implements java.util.Iterator<E>
Base class for Iterators for LinkedBlockingDeque
-
-
Field Summary
Fields Modifier and Type Field Description 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
Constructors Constructor Description AbstractItr()
Create a new iterator.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) void
advance()
Advances next.(package private) abstract LinkedBlockingDeque.Node<E>
firstNode()
Obtain the first node to be returned by the iterator.boolean
hasNext()
E
next()
(package private) abstract LinkedBlockingDeque.Node<E>
nextNode(LinkedBlockingDeque.Node<E> n)
For a given node, obtain the next node to be returned by the iterator.void
remove()
private LinkedBlockingDeque.Node<E>
succ(LinkedBlockingDeque.Node<E> n)
Returns the successor node of the given non-null, but possibly previously deleted, node.
-
-
-
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.
-
-
Method Detail
-
firstNode
abstract LinkedBlockingDeque.Node<E> firstNode()
Obtain the first node to be returned by the iterator.- Returns:
- first node
-
nextNode
abstract LinkedBlockingDeque.Node<E> nextNode(LinkedBlockingDeque.Node<E> n)
For a given node, obtain the next node to be returned by the iterator.- Parameters:
n
- given node- Returns:
- next node
-
succ
private LinkedBlockingDeque.Node<E> succ(LinkedBlockingDeque.Node<E> n)
Returns the successor node of the given non-null, but possibly previously deleted, node.- Parameters:
n
- node whose successor is sought- Returns:
- successor node
-
advance
void advance()
Advances next.
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<E>
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<E>
-
-