Class AbstractMap.IteratorAdapter<K,V>

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

protected static class AbstractMap.IteratorAdapter<K,V> extends AbstractMap.EntryIterator<K,V>
An implementation of AbstractMap.EntryIterator which delegates its work to a standard iterator. Subclasses can modify the value or other properties during iteration.

This method does not implement the AbstractMap.EntryIterator.remove() method, thus assuming an unmodifiable map (which is consistent with the default implementation of AbstractMap methods). Modifiable maps should override remove() themselves.

See Also:
  • Field Details

    • it

      protected Iterator<Map.Entry<K,V>> it
      The standard iterator on which to delegate the work. It is safe to change this value before to invoke next().
    • entry

      protected Map.Entry<K,V> entry
      The entry found by the last call to next().
    • value

      protected V value
      The value of entry.getValue()}. It is safe to change this value after next() invocation.
  • Constructor Details

    • IteratorAdapter

      public IteratorAdapter(Map<K,V> map)
      Creates a new adapter initialized to the entry iterator of the given map.
      Parameters:
      map - the map from which to return entries.
  • Method Details

    • next

      protected boolean next()
      Moves to the next entry having a non-null value. If this method returns true, then the entry and value fields are set to the properties of the new current entry. Otherwise (if this method returns false) the entry and value fields are undetermined.
      Specified by:
      next in class AbstractMap.EntryIterator<K,V>
      Returns:
      false if this method reached iteration end.
    • getKey

      protected K getKey()
      Returns entry.getKey()}.
      Specified by:
      getKey in class AbstractMap.EntryIterator<K,V>
      Returns:
      the key at the current iterator position.
    • getValue

      protected V getValue()
      Returns value, which was itself initialized to entry.getValue()}.
      Specified by:
      getValue in class AbstractMap.EntryIterator<K,V>
      Returns:
      the value at the current iterator position.