Class SimpleOverflowMap.KeyIterator

java.lang.Object
com.tangosol.net.cache.SimpleOverflowMap.KeyIterator
All Implemented Interfaces:
Iterator
Enclosing class:
SimpleOverflowMap

protected class SimpleOverflowMap.KeyIterator extends Object implements Iterator
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 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.)
      Specified by:
      hasNext in interface Iterator
      Returns:
      true if the iterator has more elements
    • next

      public Object next()
      Returns the next element in the iteration.
      Specified by:
      next in interface Iterator
      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 interface Iterator
      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.