Package org.apache.sis.internal.util
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>
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 thanResultSet.next()
. - Entry elements are returned by the
getKey()
andgetValue()
methods instead of creating newMap.Element
on each iterator.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetEntry()
Returns the entry at the current iterator position.protected abstract K
getKey()
Returns the key at the current iterator position.protected abstract V
getValue()
Returns the value at the current iterator position.protected abstract boolean
next()
Moves the iterator to the next position, and returnstrue
if there is at least one remaining element.protected void
remove()
Removes the entry at the current iterator position (optional operation).
-
Constructor Details
-
EntryIterator
protected EntryIterator()
-
-
Method Details
-
next
protected abstract boolean next()Moves the iterator to the next position, and returnstrue
if there is at least one remaining element.- Returns:
false
if this method reached iteration end.
-
getKey
Returns the key at the current iterator position. This method is invoked only afternext()
.- Returns:
- the key at the current iterator position.
-
getValue
Returns the value at the current iterator position. This method is invoked only afternext()
.- Returns:
- the value at the current iterator position.
-
getEntry
Returns the entry at the current iterator position. This method is invoked only afternext()
. The default implementation creates an immutable entry withgetKey()
andgetValue()
.- Returns:
- the entry at the current iterator position.
-
remove
Removes the entry at the current iterator position (optional operation). The default implementation throwsUnsupportedOperationException
.- Throws:
UnsupportedOperationException
-