Package com.tangosol.net.cache
Class SimpleOverflowMap.KeyIterator
java.lang.Object
com.tangosol.net.cache.SimpleOverflowMap.KeyIterator
- All Implemented Interfaces:
Iterator
- Enclosing class:
SimpleOverflowMap
An Iterator implementation that attempts to provide the most resilient
and most up-to-date view of the keys in the OverflowMap. This means
that it will avoid throwing a ConcurrentModificationException, and that
it will attempt to directly use the underlying iterators available for
the front and back maps.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
advance()
Advance to the next key.boolean
hasNext()
Returns true if the iteration has more elements.next()
Returns the next element in the iteration.void
remove()
Removes from the underlying collection the last element returned by the iterator.protected void
Switch to an iterator over the back map.protected void
Switch to an iterator over nothing.protected void
Switch to a snapshot iterator.protected void
Switch to a snapshot iterator.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
KeyIterator
public KeyIterator()Default constructor.
-
-
Method Details
-
hasNext
public boolean hasNext()Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.) -
next
Returns the next element in the iteration.- Specified by:
next
in interfaceIterator
- Returns:
- the next element in the iteration
- Throws:
NoSuchElementException
- if the Iterator has no more elements
-
remove
public void remove()Removes from the underlying collection the last element returned by the iterator.- Specified by:
remove
in interfaceIterator
- Throws:
IllegalStateException
- if the next method has not yet been called, or the remove method has already been called after the last call to the next method
-
advance
protected boolean advance()Advance to the next key.- Returns:
- true if there is a next key
-
useFrontIterator
protected void useFrontIterator()Switch to a snapshot iterator. -
useBackIterator
protected void useBackIterator()Switch to an iterator over the back map. -
useSnapshotIterator
protected void useSnapshotIterator()Switch to a snapshot iterator. -
useDoneIterator
protected void useDoneIterator()Switch to an iterator over nothing.
-