commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r751890 - in /commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections: Get.java IterableGet.java IterableMap.java Put.java
Date Mon, 09 Mar 2009 22:45:37 GMT
Author: mbenson
Date: Mon Mar  9 22:45:37 2009
New Revision: 751890

URL: http://svn.apache.org/viewvc?rev=751890&view=rev
Log:
extract Put, Get, and IterableGet interfaces from IterableMap such that our Maps, which all
implement IterableMap, can have their read/write functionality exposed separately.

Added:
    commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Get.java
  (with props)
    commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableGet.java
  (with props)
    commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Put.java
  (with props)
Modified:
    commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableMap.java

Added: commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Get.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Get.java?rev=751890&view=auto
==============================================================================
--- commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Get.java
(added)
+++ commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Get.java
Mon Mar  9 22:45:37 2009
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * The "read" subset of the {@link Map} interface.
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ * @see Put
+ * @author Matt Benson
+ */
+public interface Get<K, V> {
+
+    /**
+     * @see Map#containsKey(Object)
+     */
+    public boolean containsKey(Object key);
+
+    /**
+     * @see Map#containsValue(Object)
+     */
+    public boolean containsValue(Object value);
+
+    /**
+     * @see Map#entrySet()
+     */
+    public Set<java.util.Map.Entry<K, V>> entrySet();
+
+    /**
+     * @see Map#get(Object)
+     */
+    public V get(Object key);
+
+    /**
+     * @see Map#remove(Object)
+     */
+    public V remove(Object key);
+
+    /**
+     * @see Map#isEmpty()
+     */
+    public boolean isEmpty();
+
+    /**
+     * @see Map#keySet()
+     */
+    public Set<K> keySet();
+
+    /**
+     * @see Map#size()
+     */
+    public int size();
+
+    /**
+     * @see Map#values()
+     */
+    public Collection<V> values();
+}

Propchange: commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Get.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Get.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableGet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableGet.java?rev=751890&view=auto
==============================================================================
--- commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableGet.java
(added)
+++ commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableGet.java
Mon Mar  9 22:45:37 2009
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections;
+
+import java.util.Map;
+
+/**
+ * The "read" subset of the {@link Map} interface.
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ * @see Put
+ * @author Matt Benson
+ */
+public interface IterableGet<K, V> extends Get<K, V> {
+    /**
+     * 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 use Map Entry objects.
+     * <pre>
+     * IterableMap<String,Integer> map = new HashedMap<String,Integer>();
+     * MapIterator<String,Integer> it = map.mapIterator();
+     * while (it.hasNext()) {
+     *   String key = it.next();
+     *   Integer value = it.getValue();
+     *   it.setValue(value + 1);
+     * }
+     * </pre>
+     * 
+     * @return a map iterator
+     */
+    MapIterator<K, V> mapIterator();
+
+}

Propchange: commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableGet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableGet.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableMap.java?rev=751890&r1=751889&r2=751890&view=diff
==============================================================================
--- commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableMap.java
(original)
+++ commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/IterableMap.java
Mon Mar  9 22:45:37 2009
@@ -40,25 +40,5 @@
  *
  * @author Stephen Colebourne
  */
-public interface IterableMap<K, V> extends Map<K, V> {
-
-    /**
-     * 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 use Map Entry objects.
-     * <pre>
-     * IterableMap<String,Integer> map = new HashedMap<String,Integer>();
-     * MapIterator<String,Integer> it = map.mapIterator();
-     * while (it.hasNext()) {
-     *   String key = it.next();
-     *   Integer value = it.getValue();
-     *   it.setValue(value + 1);
-     * }
-     * </pre>
-     * 
-     * @return a map iterator
-     */
-    MapIterator<K, V> mapIterator();
-
+public interface IterableMap<K, V> extends Map<K, V>, Put<K, V>, IterableGet<K,
V> {
 }

Added: commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Put.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Put.java?rev=751890&view=auto
==============================================================================
--- commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Put.java
(added)
+++ commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Put.java
Mon Mar  9 22:45:37 2009
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections;
+
+import java.util.Map;
+
+/**
+ * The "write" subset of the {@link Map} interface.
+ * @since Commons Collections 5
+ * @TODO fix version
+ * @version $Revision$ $Date$
+ * @see Get
+ * @author Matt Benson
+ */
+public interface Put<K, V> {
+
+    /**
+     * @see Map#clear()
+     */
+    public void clear();
+
+    /**
+     * @see Map#put(Object, Object)
+     */
+    public Object put(K key, V value);
+
+    /**
+     * @see Map#putAll(Map)
+     */
+    public void putAll(Map<? extends K, ? extends V> t);
+
+}

Propchange: commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Put.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/collections/branches/collections_jdk5_branch/src/java/org/apache/commons/collections/Put.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message