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

public final Class UnmodifiableOrderedMapIterator<K, V>

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

Decorates an ordered 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 OrderedMapIterator<? extends K, ? extends V>
iterator

The iterator being decorated

Constructor Summary

AccessConstructor and Description
private
UnmodifiableOrderedMapIterator(final OrderedMapIterator<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, java.util.Iterator.hasNext.

Checks to see if there are more entries still to be iterated.
public boolean
hasPrevious()

Implements org.apache.commons.collections4.OrderedMapIterator.hasPrevious.

Checks to see if there is a previous entry that can be iterated to.
public K
public K
previous()

Implements org.apache.commons.collections4.OrderedMapIterator.previous.

Gets the previous key from the Map.
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 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
>
OrderedMapIterator<K, V>

Returns:

a new unmodifiable ordered map iterator
unmodifiableOrderedMapIterator
(final OrderedMapIterator<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 OrderedMapIterator<? extends K, ? extends V> iterator

The iterator being decorated

Constructor Detail

UnmodifiableOrderedMapIteratorback to summary
private UnmodifiableOrderedMapIterator(final OrderedMapIterator<K, ? extends V> iterator)

Constructor.

Parameters
iterator:OrderedMapIterator<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, 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
hasPreviousback to summary
public boolean hasPrevious()

Implements org.apache.commons.collections4.OrderedMapIterator.hasPrevious.

Doc from org.apache.commons.collections4.OrderedMapIterator.hasPrevious.

Checks to see if there is a previous entry that can be iterated to.

Returns:boolean

true if the iterator has a previous element

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
previousback to summary
public K previous()

Implements org.apache.commons.collections4.OrderedMapIterator.previous.

Doc from org.apache.commons.collections4.OrderedMapIterator.previous.

Gets the previous key from the Map.

Returns:K

the previous 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
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
unmodifiableOrderedMapIteratorback to summary
public static <K, V> OrderedMapIterator<K, V> unmodifiableOrderedMapIterator(final OrderedMapIterator<K, ? extends V> iterator)

Decorates the specified iterator such that it cannot be modified.

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

the iterator to decorate

Returns:OrderedMapIterator<K, V>

a new unmodifiable ordered map iterator

Exceptions
NullPointerException:
if the iterator is null