Class SingletonMap.SingletonMapIterator
- java.lang.Object
-
- org.apache.commons.collections.map.SingletonMap.SingletonMapIterator
-
- All Implemented Interfaces:
java.util.Iterator,MapIterator,OrderedIterator,OrderedMapIterator,ResettableIterator
- Enclosing class:
- SingletonMap
static class SingletonMap.SingletonMapIterator extends java.lang.Object implements OrderedMapIterator, ResettableIterator
SingletonMapIterator.
-
-
Field Summary
Fields Modifier and Type Field Description private booleancanGetSetprivate booleanhasNextprivate SingletonMapparent
-
Constructor Summary
Constructors Constructor Description SingletonMapIterator(SingletonMap parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetKey()Gets the current key, which is the key returned by the last call tonext().java.lang.ObjectgetValue()Gets the current value, which is the value associated with the last key returned bynext().booleanhasNext()Checks to see if there are more entries still to be iterated.booleanhasPrevious()Checks to see if there is a previous entry that can be iterated to.java.lang.Objectnext()Gets the next key from theMap.java.lang.Objectprevious()Gets the previous key from theMap.voidremove()Removes the last returned key from the underlyingMap(optional operation).voidreset()Resets the iterator back to the position at which the iterator was created.java.lang.ObjectsetValue(java.lang.Object value)Sets the value associated with the current key (optional operation).java.lang.StringtoString()
-
-
-
Field Detail
-
parent
private final SingletonMap parent
-
hasNext
private boolean hasNext
-
canGetSet
private boolean canGetSet
-
-
Constructor Detail
-
SingletonMapIterator
SingletonMapIterator(SingletonMap parent)
-
-
Method Detail
-
hasNext
public boolean hasNext()
Description copied from interface:MapIteratorChecks to see if there are more entries still to be iterated.- Specified by:
hasNextin interfacejava.util.Iterator- Specified by:
hasNextin interfaceMapIterator- Returns:
trueif the iterator has more elements
-
next
public java.lang.Object next()
Description copied from interface:MapIteratorGets the next key from theMap.- Specified by:
nextin interfacejava.util.Iterator- Specified by:
nextin interfaceMapIterator- Returns:
- the next key in the iteration
-
hasPrevious
public boolean hasPrevious()
Description copied from interface:OrderedMapIteratorChecks to see if there is a previous entry that can be iterated to.- Specified by:
hasPreviousin interfaceOrderedIterator- Specified by:
hasPreviousin interfaceOrderedMapIterator- Returns:
trueif the iterator has a previous element
-
previous
public java.lang.Object previous()
Description copied from interface:OrderedMapIteratorGets the previous key from theMap.- Specified by:
previousin interfaceOrderedIterator- Specified by:
previousin interfaceOrderedMapIterator- Returns:
- the previous key in the iteration
-
remove
public void remove()
Description copied from interface:MapIteratorRemoves the last returned key from the underlyingMap(optional operation).This method can be called once per call to
next().- Specified by:
removein interfacejava.util.Iterator- Specified by:
removein interfaceMapIterator
-
getKey
public java.lang.Object getKey()
Description copied from interface:MapIteratorGets the current key, which is the key returned by the last call tonext().- Specified by:
getKeyin interfaceMapIterator- Returns:
- the current key
-
getValue
public java.lang.Object getValue()
Description copied from interface:MapIteratorGets the current value, which is the value associated with the last key returned bynext().- Specified by:
getValuein interfaceMapIterator- Returns:
- the current value
-
setValue
public java.lang.Object setValue(java.lang.Object value)
Description copied from interface:MapIteratorSets the value associated with the current key (optional operation).- Specified by:
setValuein interfaceMapIterator- Parameters:
value- the new value- Returns:
- the previous value
-
reset
public void reset()
Description copied from interface:ResettableIteratorResets the iterator back to the position at which the iterator was created.- Specified by:
resetin interfaceResettableIterator
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-