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

public final Class UnmodifiableMapIterator<K, V>

extends Object
implements MapIterator<K, V>, Unmodifiable
Class Inheritance
All Implemented Interfaces
org.apache.commons.collections4.Unmodifiable, org.apache.commons.collections4.MapIterator, java.util.Iterator
Type Parameters
<K>
the type of keys
<V>
the type of mapped values
Imports
org.apache.commons.collections4.MapIterator, .Unmodifiable

Decorates a map iterator such that it cannot be modified.

Attempts to modify it will result in an UnsupportedOperationException.

Since
3.0

Field Summary

Modifier and TypeField and Description
private final MapIterator<? extends K, ? extends V>
iterator

The iterator being decorated

Constructor Summary

AccessConstructor and Description
private
UnmodifiableMapIterator(final MapIterator<? extends K, ? extends V>
the iterator to decorate
iterator
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
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.

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

Implements org.apache.commons.collections4.MapIterator.next.

Gets the next key from the Map.
public void
remove()

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

Removes the last returned key from the underlying Map (optional operation).
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).
public static <
the key type
K
,
the value type
V
>
MapIterator<K, V>

Returns:

a new unmodifiable map iterator
unmodifiableMapIterator
(final MapIterator<? extends K, ? extends V>
the iterator to decorate
iterator
)

Decorates the specified iterator such that it cannot be modified.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iteratorback to summary
private final MapIterator<? extends K, ? extends V> iterator

The iterator being decorated

Constructor Detail

UnmodifiableMapIteratorback to summary
private UnmodifiableMapIterator(final MapIterator<? extends K, ? extends V> iterator)

Constructor.

Parameters
iterator:MapIterator<? extends K, ? extends V>

the iterator to decorate

Method Detail

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.

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.

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()

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
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
unmodifiableMapIteratorback to summary
public static <K, V> MapIterator<K, V> unmodifiableMapIterator(final MapIterator<? extends K, ? extends V> iterator)

Decorates the specified iterator such that it cannot be modified.

Parameters
<K>
the key type
<V>
the value type
iterator:MapIterator<? extends K, ? extends V>

the iterator to decorate

Returns:MapIterator<K, V>

a new unmodifiable map iterator

Exceptions
NullPointerException:
if the iterator is null