Class ConcurrentReaderHashMap.HashIterator

java.lang.Object
org.codehaus.groovy.runtime.metaclass.ConcurrentReaderHashMap.HashIterator
All Implemented Interfaces:
Enumeration, Iterator
Direct Known Subclasses:
ConcurrentReaderHashMap.KeyIterator, ConcurrentReaderHashMap.ValueIterator
Enclosing class:
ConcurrentReaderHashMap

protected class ConcurrentReaderHashMap.HashIterator extends Object implements Iterator, Enumeration
  • Field Details

  • Constructor Details

    • HashIterator

      protected HashIterator()
      Constructs a new HashIterator over a snapshot of the table.
  • Method Details

    • hasMoreElements

      public boolean hasMoreElements()
      Returns whether there are more elements (Enumeration interface).
      Specified by:
      hasMoreElements in interface Enumeration
      Returns:
      true if there are more elements, false otherwise
    • nextElement

      public Object nextElement()
      Returns the next element (Enumeration interface).
      Specified by:
      nextElement in interface Enumeration
      Returns:
      the next element
      Throws:
      NoSuchElementException - if there are no more elements
    • hasNext

      public boolean hasNext()
      Returns whether there are more elements to iterate over.
      Specified by:
      hasNext in interface Iterator
      Returns:
      true if there are more elements, false otherwise
    • returnValueOfNext

      protected Object returnValueOfNext()
      Returns the value of the next element. This method can be overridden by subclasses to return different values (e.g., just the key or just the value instead of the whole entry).
      Returns:
      the value to return for the next element
    • next

      public Object next()
      Returns the next element in the iteration.
      Specified by:
      next in interface Iterator
      Returns:
      the next element
      Throws:
      NoSuchElementException - if there are no more elements
    • remove

      public void remove()
      Removes the last returned element from the map.
      Specified by:
      remove in interface Iterator
      Throws:
      IllegalStateException - if next() has not been called or remove() has already been called after the last next() call