Package com.usatiuk.objects.iterators
Class NavigableMapKvIterator<K extends Comparable<K>,V>
java.lang.Object
com.usatiuk.objects.iterators.ReversibleKvIterator<K,V>
com.usatiuk.objects.iterators.NavigableMapKvIterator<K,V>
- Type Parameters:
K
- the type of the keysV
- the type of the values
- All Implemented Interfaces:
CloseableKvIterator<K,
,V> AutoCloseable
,Iterator<org.apache.commons.lang3.tuple.Pair<K,
V>>
A key-value iterator for a
NavigableMap
.
It allows iterating over the keys and values in a sorted order.-
Field Summary
Fields inherited from class com.usatiuk.objects.iterators.ReversibleKvIterator
_goingForward
-
Constructor Summary
ConstructorsConstructorDescriptionNavigableMapKvIterator
(NavigableMap<K, ? extends V> map, IteratorStart start, K key) Constructs a NavigableMapKvIterator with the specified map, start type, and start key. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected boolean
hasImpl()
Checks if there is a next element in the iterator, depending on the current direction.nextImpl()
Returns the next element in the iterator, depending on the current direction.protected K
peekImpl()
Fills the next element in the iterator, depending on the current direction.protected void
reverse()
Reverses the current direction of the iterator.protected void
skipImpl()
Skips the next element in the iterator, depending on the current direction.toString()
Methods inherited from class com.usatiuk.objects.iterators.ReversibleKvIterator
hasNext, hasPrev, next, peekNextKey, peekPrevKey, prev, skip, skipPrev
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.usatiuk.objects.iterators.CloseableKvIterator
reversed
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
Method Details
-
reverse
protected void reverse()Description copied from class:ReversibleKvIterator
Reverses the current direction of the iterator.- Specified by:
reverse
in classReversibleKvIterator<K extends Comparable<K>,
V>
-
peekImpl
Description copied from class:ReversibleKvIterator
Fills the next element in the iterator, depending on the current direction.- Specified by:
peekImpl
in classReversibleKvIterator<K extends Comparable<K>,
V>
-
skipImpl
protected void skipImpl()Description copied from class:ReversibleKvIterator
Skips the next element in the iterator, depending on the current direction.- Specified by:
skipImpl
in classReversibleKvIterator<K extends Comparable<K>,
V>
-
hasImpl
protected boolean hasImpl()Description copied from class:ReversibleKvIterator
Checks if there is a next element in the iterator, depending on the current direction.- Specified by:
hasImpl
in classReversibleKvIterator<K extends Comparable<K>,
V> - Returns:
- true if there is a next element, false otherwise
-
nextImpl
Description copied from class:ReversibleKvIterator
Returns the next element in the iterator, depending on the current direction.- Specified by:
nextImpl
in classReversibleKvIterator<K extends Comparable<K>,
V> - Returns:
- the next element
-
close
public void close() -
toString
-