Package: org.codehaus.groovy.runtime.metaclass

## [Java] Class ConcurrentReaderHashMap.HashIterator

- org.codehaus.groovy.runtime.metaclass.ConcurrentReaderHashMap.HashIterator

- All Implemented Interfaces and Traits:
    Iterator, Enumeration

      protected class ConcurrentReaderHashMap.HashIterator
      extends Object
      implements Iterator, Enumeration

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected Object` | `currentKey` |
    `protected Object` | `currentValue` |
    `protected ConcurrentReaderHashMap.Entry` | `entry` |
    `protected int` | `index` |
    `protected ConcurrentReaderHashMap.Entry` | `lastReturned` |
    `protected ConcurrentReaderHashMap.Entry[]` | `tab` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `protected HashIterator()` Constructs a new HashIterator over a snapshot of the table.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `hasMoreElements()` Returns whether there are more elements (Enumeration interface).
    `` | `public boolean` | `hasNext()` Returns whether there are more elements to iterate over.
    `` | `public Object` | `next()` Returns the next element in the iteration.
    `` | `public Object` | `nextElement()` Returns the next element (Enumeration interface).
    `` | `public void` | `remove()` Removes the last returned element from the map.
    `` | `protected Object` | `returnValueOfNext()` Returns the value of the next element.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### protected Object currentKey

    - #### protected Object currentValue

    - #### protected ConcurrentReaderHashMap.Entry entry

    - #### protected int index

    - #### protected ConcurrentReaderHashMap.Entry lastReturned

    - #### protected final ConcurrentReaderHashMap.Entry[] tab

  - ### Constructor Detail

    - #### protected HashIterator()

      Constructs a new HashIterator over a snapshot of the table.

  - ### Method Detail

    - #### public boolean hasMoreElements()

      Returns whether there are more elements (Enumeration interface).

      Returns:
        true if there are more elements, false otherwise

    - #### public boolean hasNext()

      Returns whether there are more elements to iterate over.

      Returns:
        true if there are more elements, false otherwise

    - #### public Object next()

      Returns the next element in the iteration.

      throws:
        NoSuchElementException if there are no more elements
      Returns:
        the next element

    - #### public Object nextElement()

      Returns the next element (Enumeration interface).

      throws:
        NoSuchElementException if there are no more elements
      Returns:
        the next element

    - #### public void remove()

      Removes the last returned element from the map.

      throws:
        IllegalStateException if next() has not been called or remove() has already been called after the last next() call

    - #### 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