Top Description Fields Constructors Methods
org.apache.commons.collections4.map

public Class EntrySetToMapIteratorAdapter<K, V>

extends Object
implements MapIterator<K, V>, ResettableIterator<K>
Class Inheritance
All Implemented Interfaces
org.apache.commons.collections4.ResettableIterator, java.util.Iterator, org.apache.commons.collections4.MapIterator
Known Direct Subclasses
org.apache.commons.collections4.map.AbstractSortedMapDecorator.SortedMapIterator
Type Parameters
<K>
the type of the keys in the map
<V>
the type of the values in the map
Imports
java.util.Iterator, .Map, .Set, org.apache.commons.collections4.MapIterator, .ResettableIterator

Adapts a Map entrySet to the MapIterator interface.
Since
4.0

Field Summary

Modifier and TypeField and Description
pack-priv transient Map.Entry<K, V>
entry

The currently positioned Map entry.

pack-priv Set<Map.Entry<K, V>>
entrySet

The adapted Map entry Set.

pack-priv transient Iterator<Map.Entry<K, V>>
iterator

The resettable iterator in use.

Constructor Summary

AccessConstructor and Description
public
EntrySetToMapIteratorAdapter(final Set<Map.Entry<K, V>>
the entrySet to adapt
entrySet
)

Create a new EntrySetToMapIteratorAdapter.

Method Summary

Modifier and TypeMethod and Description
protected synchronized Map.Entry<K, V>

Returns:

Map.Entry<K, V>
current
()

Get the currently active entry.

public K
getKey()

Implements org.apache.commons.collections4.MapIterator.getKey.

Gets the current key, which is the key returned by the last call to next().
public V
getValue()

Implements org.apache.commons.collections4.MapIterator.getValue.

Gets the current value, which is the value associated with the last key returned by next().
public boolean
hasNext()

Implements org.apache.commons.collections4.MapIterator.hasNext, java.util.Iterator.hasNext.

Checks to see if there are more entries still to be iterated.
public K
public void
remove()

Overrides default java.util.Iterator.remove.

Implements org.apache.commons.collections4.MapIterator.remove.

Removes the last returned key from the underlying Map (optional operation).
public synchronized void
reset()

Implements org.apache.commons.collections4.ResettableIterator.reset.

Resets the iterator back to the position at which the iterator was created.
public V
setValue(final V
the new value
value
)

Implements org.apache.commons.collections4.MapIterator.setValue.

Sets the value associated with the current key (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entryback to summary
pack-priv transient Map.Entry<K, V> entry

The currently positioned Map entry.

entrySetback to summary
pack-priv Set<Map.Entry<K, V>> entrySet

The adapted Map entry Set.

iteratorback to summary
pack-priv transient Iterator<Map.Entry<K, V>> iterator

The resettable iterator in use.

Constructor Detail

EntrySetToMapIteratorAdapterback to summary
public EntrySetToMapIteratorAdapter(final Set<Map.Entry<K, V>> entrySet)

Create a new EntrySetToMapIteratorAdapter.

Parameters
entrySet:Set<Map.Entry<K, V>>

the entrySet to adapt

Method Detail

currentback to summary
protected synchronized Map.Entry<K, V> current()

Get the currently active entry.

Returns:Map.Entry<K, V>

Map.Entry<K, V>

getKeyback to summary
public K getKey()

Implements org.apache.commons.collections4.MapIterator.getKey.

Doc from org.apache.commons.collections4.MapIterator.getKey.

Gets the current key, which is the key returned by the last call to next().

Returns:K

the current key

Annotations
@Override
getValueback to summary
public V getValue()

Implements org.apache.commons.collections4.MapIterator.getValue.

Doc from org.apache.commons.collections4.MapIterator.getValue.

Gets the current value, which is the value associated with the last key returned by next().

Returns:V

the current value

Annotations
@Override
hasNextback to summary
public boolean hasNext()

Implements org.apache.commons.collections4.MapIterator.hasNext, java.util.Iterator.hasNext.

Doc from org.apache.commons.collections4.MapIterator.hasNext.

Checks to see if there are more entries still to be iterated.

Returns:boolean

true if the iterator has more elements

Annotations
@Override
nextback to summary
public K next()

Implements org.apache.commons.collections4.MapIterator.next, java.util.Iterator.next.

Doc from org.apache.commons.collections4.MapIterator.next.

Gets the next key from the Map.

Returns:K

the next key in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Implements org.apache.commons.collections4.MapIterator.remove.

Doc from org.apache.commons.collections4.MapIterator.remove.

Removes the last returned key from the underlying Map (optional operation).

This method can be called once per call to next().

Annotations
@Override
resetback to summary
public synchronized void reset()

Implements org.apache.commons.collections4.ResettableIterator.reset.

Doc from org.apache.commons.collections4.ResettableIterator.reset.

Resets the iterator back to the position at which the iterator was created.

Annotations
@Override
setValueback to summary
public V setValue(final V value)

Implements org.apache.commons.collections4.MapIterator.setValue.

Doc from org.apache.commons.collections4.MapIterator.setValue.

Sets the value associated with the current key (optional operation).

Parameters
value:V

the new value

Returns:V

the previous value

Annotations
@Override