Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956.
Also see the following revisions: ------------------------------------------------------------------------ r751890 | mbenson | 2009-03-09 15:45:37 -0700 (Mon, 09 Mar 2009) | 1 line extract Put, Get, and IterableGet interfaces from IterableMap such that our Maps, which all implement IterableMap, can have their read/write functionality exposed separately. ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8aff2c25f4
commit
8c6e10da8c
|
@ -22,41 +22,24 @@ import java.util.Map;
|
|||
* Defines a map that can be iterated directly without needing to create an entry set.
|
||||
* <p>
|
||||
* A map iterator is an efficient way of iterating over maps.
|
||||
* There is no need to access the entry set or cast to Map Entry objects.
|
||||
* There is no need to access the entry set or use Map Entry objects.
|
||||
* <pre>
|
||||
* IterableMap map = new HashedMap();
|
||||
* MapIterator it = map.mapIterator();
|
||||
* IterableMap<String,Integer> map = new HashedMap<String,Integer>();
|
||||
* MapIterator<String,Integer> it = map.mapIterator();
|
||||
* while (it.hasNext()) {
|
||||
* Object key = it.next();
|
||||
* Object value = it.getValue();
|
||||
* it.setValue("newValue");
|
||||
* String key = it.next();
|
||||
* Integer value = it.getValue();
|
||||
* it.setValue(value + 1);
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @param <K> the type of the keys in the map
|
||||
* @param <V> the type of the values in the map
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision$ $Date$
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public interface IterableMap extends Map {
|
||||
|
||||
/**
|
||||
* Obtains a <code>MapIterator</code> over the map.
|
||||
* <p>
|
||||
* A map iterator is an efficient way of iterating over maps.
|
||||
* There is no need to access the entry set or cast to Map Entry objects.
|
||||
* <pre>
|
||||
* IterableMap map = new HashedMap();
|
||||
* MapIterator it = map.mapIterator();
|
||||
* while (it.hasNext()) {
|
||||
* Object key = it.next();
|
||||
* Object value = it.getValue();
|
||||
* it.setValue("newValue");
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @return a map iterator
|
||||
*/
|
||||
MapIterator mapIterator();
|
||||
|
||||
public interface IterableMap<K, V> extends Map<K, V>, Put<K, V>, IterableGet<K, V> {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue