protected class DynamicCollection.DynamicIterator
extends java.lang.Object
implements java.util.Iterator<E>
| Modifier and Type | Field and Description |
|---|---|
protected int |
cursor
Cursor pointing to the element that has to be returned by
next() method. |
protected java.lang.Boolean |
hasNext
Iterator variable - not thread-safe/synchronized since only one
thread should use the iterator.
|
protected java.lang.Object |
lock
Lock protecting the cursor and tailGhost which might be affected by
the backing collection shrinking.
|
protected boolean |
removalAllowed
Iterator variable - not thread-safe/synchronized since only one
thread should use the iterator.
|
protected E |
tailGhost
Temporary object holder.
|
| Modifier | Constructor and Description |
|---|---|
protected |
DynamicIterator() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext() |
E |
next() |
protected int |
removalIndex(int cursor) |
void |
remove() |
(package private) void |
removeObject(int index,
E o)
Removes the object from the underlying collection.
|
protected boolean |
unsafeHasNext()
Updates the hasNext field.
|
protected volatile int cursor
next() method. This element needs to be synchronized.protected volatile E tailGhost
protected final java.lang.Object lock
protected java.lang.Boolean hasNext
protected boolean removalAllowed
public boolean hasNext()
hasNext in interface java.util.Iterator<E>protected boolean unsafeHasNext()
public void remove()
remove in interface java.util.Iterator<E>protected int removalIndex(int cursor)
void removeObject(int index,
E o)
index - o -