commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r815057 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/IterableMap.java
Date Tue, 15 Sep 2009 05:55:26 GMT
Author: bayard
Date: Tue Sep 15 05:55:25 2009
New Revision: 815057

URL: http://svn.apache.org/viewvc?rev=815057&view=rev
Log:
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.
    ------------------------------------------------------------------------

Modified:
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/IterableMap.java

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/IterableMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/IterableMap.java?rev=815057&r1=815056&r2=815057&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/IterableMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/IterableMap.java
Tue Sep 15 05:55:25 2009
@@ -22,41 +22,24 @@
  * 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> {
 }



Mime
View raw message