# Class AbstractSortedMapDecorator.SortedMapIterator<K,V>

java.lang.Object
org.apache.commons.collections4.map.EntrySetToMapIteratorAdapter<K,V>
org.apache.commons.collections4.map.AbstractSortedMapDecorator.SortedMapIterator<K,V>

Type Parameters:
  `K` - the key type
  `V` - the value type

All Implemented Interfaces:
  `Iterator<K>`, `MapIterator<K,V>`, `OrderedIterator<K>`, `OrderedMapIterator<K,V>`, `ResettableIterator<K>`

Enclosing class:
  `AbstractSortedMapDecorator<K,V>`

protected static class AbstractSortedMapDecorator.SortedMapIterator<K,V> extends EntrySetToMapIteratorAdapter<K,V> implements OrderedMapIterator<K,V>
OrderedMapIterator implementation.

Since:
  3.0

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `SortedMapIterator(Set<Map.Entry<K,V>> entrySet)`
  Create a new AbstractSortedMapDecorator.SortedMapIterator.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `hasPrevious()`
  Checks to see if there is a previous entry that can be iterated to.
  `K`
  `previous()`
  Gets the previous key from the `Map`.
  `void`
  `reset()`
  Resets the iterator back to the position at which the iterator was created.

  ### Methods inherited from class org.apache.commons.collections4.map.EntrySetToMapIteratorAdapter

  `current, getKey, getValue, hasNext, next, remove, setValue`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.util.Iterator

  `forEachRemaining`

  ### Methods inherited from interface org.apache.commons.collections4.MapIterator

  `getKey, getValue, hasNext, next, remove, setValue`

- ## Constructor Details

  - ### SortedMapIterator

    protected SortedMapIterator(Set<Map.Entry<K,V>> entrySet)
    Create a new AbstractSortedMapDecorator.SortedMapIterator.
    Parameters:
      `entrySet` - the entrySet to iterate

- ## Method Details

  - ### hasPrevious

    public boolean hasPrevious()
    Checks to see if there is a previous entry that can be iterated to.
    Specified by:
      `hasPrevious` in interface `OrderedIterator<K>`
    Specified by:
      `hasPrevious` in interface `OrderedMapIterator<K,V>`
    Returns:
      `true` if the iterator has a previous element

  - ### previous

    public K previous()
    Gets the previous key from the `Map`.
    Specified by:
      `previous` in interface `OrderedIterator<K>`
    Specified by:
      `previous` in interface `OrderedMapIterator<K,V>`
    Returns:
      the previous key in the iteration

  - ### reset

    public void reset()
    Resets the iterator back to the position at which the iterator was created.
    Specified by:
      `reset` in interface `ResettableIterator<K>`
    Overrides:
      `reset` in class `EntrySetToMapIteratorAdapter<K,V>`