org.apache.commons.collections4.map
Class AbstractIterableMap<K,V>

java.lang.Object
  extended by org.apache.commons.collections4.map.AbstractIterableMap<K,V>
All Implemented Interfaces:
Map<K,V>, Get<K,V>, IterableGet<K,V>, IterableMap<K,V>, Put<K,V>
Direct Known Subclasses:
AbstractMapDecorator, CompositeMap, StaticBucketMap

public abstract class AbstractIterableMap<K,V>
extends Object
implements IterableMap<K,V>

Provide a basic IterableMap implementation.

Since:
4.0
Version:
$Id: AbstractIterableMap.java 1469004 2013-04-17 17:37:03Z tn $

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
AbstractIterableMap()
           
 
Method Summary
 MapIterator<K,V> mapIterator()
          Obtains a MapIterator over the map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from interface org.apache.commons.collections4.Put
clear, put, putAll
 
Methods inherited from interface org.apache.commons.collections4.Get
containsKey, containsValue, entrySet, get, isEmpty, keySet, remove, size, values
 

Constructor Detail

AbstractIterableMap

public AbstractIterableMap()
Method Detail

mapIterator

public MapIterator<K,V> mapIterator()
Obtains a MapIterator over the map.

A map iterator is an efficient way of iterating over maps. There is no need to access the entry set or use Map Entry objects.

 IterableMap map = new HashedMap();
 MapIterator it = map.mapIterator();
 while (it.hasNext()) {
   String key = it.next();
   Integer value = it.getValue();
   it.setValue(value + 1);
 }
 

Specified by:
mapIterator in interface IterableGet<K,V>
Returns:
a map iterator


Copyright © 2001–2013 The Apache Software Foundation. All rights reserved.