Class AbstractMap.EntryIterator<K,V>

java.lang.Object
org.apache.sis.internal.util.AbstractMap.EntryIterator<K,V>
Type Parameters:
K - the type of keys maintained by the map.
V - the type of mapped values.
Direct Known Subclasses:
AbstractMap.IteratorAdapter, AbstractMap.KeyIterator
Enclosing class:
AbstractMap<K,V>

protected abstract static class AbstractMap.EntryIterator<K,V> extends Object
An iterator over the entries in the enclosing map. This iterator has two main differences compared to the standard Map.entrySet().iterator():
  • The next() method checks if there is more element and moves to the next one in a single step. This is exactly the same approach than ResultSet.next().
  • Entry elements are returned by the getKey() and getValue() methods instead of creating new Map.Element on each iterator.
See Also:
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Map.Entry<K,V>
    Returns the entry at the current iterator position.
    protected abstract K
    Returns the key at the current iterator position.
    protected abstract V
    Returns the value at the current iterator position.
    protected abstract boolean
    Moves the iterator to the next position, and returns true if there is at least one remaining element.
    protected void
    Removes the entry at the current iterator position (optional operation).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EntryIterator

      protected EntryIterator()
  • Method Details

    • next

      protected abstract boolean next()
      Moves the iterator to the next position, and returns true if there is at least one remaining element.
      Returns:
      false if this method reached iteration end.
    • getKey

      protected abstract K getKey()
      Returns the key at the current iterator position. This method is invoked only after next().
      Returns:
      the key at the current iterator position.
    • getValue

      protected abstract V getValue()
      Returns the value at the current iterator position. This method is invoked only after next().
      Returns:
      the value at the current iterator position.
    • getEntry

      protected Map.Entry<K,V> getEntry()
      Returns the entry at the current iterator position. This method is invoked only after next(). The default implementation creates an immutable entry with getKey() and getValue().
      Returns:
      the entry at the current iterator position.
    • remove

      protected void remove() throws UnsupportedOperationException
      Removes the entry at the current iterator position (optional operation). The default implementation throws UnsupportedOperationException.
      Throws:
      UnsupportedOperationException