You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2012/06/23 16:33:50 UTC

svn commit: r1353132 - /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/

Author: tn
Date: Sat Jun 23 14:33:48 2012
New Revision: 1353132

URL: http://svn.apache.org/viewvc?rev=1353132&view=rev
Log:
[COLLECTIONS-231] return specific type rather than base type in factory methods.

Modified:
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/DefaultedMap.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/FixedSizeMap.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/FixedSizeSortedMap.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/LazySortedMap.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ListOrderedMap.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedMap.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedMap.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/DefaultedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/DefaultedMap.java?rev=1353132&r1=1353131&r2=1353132&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/DefaultedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/DefaultedMap.java Sat Jun 23 14:33:48 2012
@@ -82,7 +82,7 @@ public class DefaultedMap<K, V> extends 
      * @param defaultValue  the default value to return when the key is not found
      * @throws IllegalArgumentException if map is null
      */
-    public static <K, V> Map<K, V> defaultedMap(Map<K, V> map, V defaultValue) {
+    public static <K, V> DefaultedMap<K, V> defaultedMap(Map<K, V> map, V defaultValue) {
         return new DefaultedMap<K, V>(map, ConstantTransformer.constantTransformer(defaultValue));
     }
 
@@ -96,7 +96,7 @@ public class DefaultedMap<K, V> extends 
      * @param factory  the factory to use to create entries, must not be null
      * @throws IllegalArgumentException if map or factory is null
      */
-    public static <K, V> IterableMap<K, V> defaultedMap(Map<K, V> map, Factory<? extends V> factory) {
+    public static <K, V> DefaultedMap<K, V> defaultedMap(Map<K, V> map, Factory<? extends V> factory) {
         if (factory == null) {
             throw new IllegalArgumentException("Factory must not be null");
         }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/FixedSizeMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/FixedSizeMap.java?rev=1353132&r1=1353131&r2=1353132&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/FixedSizeMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/FixedSizeMap.java Sat Jun 23 14:33:48 2012
@@ -69,7 +69,7 @@ public class FixedSizeMap<K, V>
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    public static <K, V> IterableMap<K, V> fixedSizeMap(Map<K, V> map) {
+    public static <K, V> FixedSizeMap<K, V> fixedSizeMap(Map<K, V> map) {
         return new FixedSizeMap<K, V>(map);
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/FixedSizeSortedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/FixedSizeSortedMap.java?rev=1353132&r1=1353131&r2=1353132&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/FixedSizeSortedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/FixedSizeSortedMap.java Sat Jun 23 14:33:48 2012
@@ -70,7 +70,7 @@ public class FixedSizeSortedMap<K, V>
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    public static <K, V> SortedMap<K, V> fixedSizeSortedMap(SortedMap<K, V> map) {
+    public static <K, V> FixedSizeSortedMap<K, V> fixedSizeSortedMap(SortedMap<K, V> map) {
         return new FixedSizeSortedMap<K, V>(map);
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/LazySortedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/LazySortedMap.java?rev=1353132&r1=1353131&r2=1353132&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/LazySortedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/LazySortedMap.java Sat Jun 23 14:33:48 2012
@@ -72,7 +72,7 @@ public class LazySortedMap<K,V>
      * @param factory  the factory to use, must not be null
      * @throws IllegalArgumentException if map or factory is null
      */
-    public static <K, V> SortedMap<K, V> lazySortedMap(SortedMap<K, V> map, Factory<? extends V> factory) {
+    public static <K, V> LazySortedMap<K, V> lazySortedMap(SortedMap<K, V> map, Factory<? extends V> factory) {
         return new LazySortedMap<K,V>(map, factory);
     }
 
@@ -83,7 +83,8 @@ public class LazySortedMap<K,V>
      * @param factory  the factory to use, must not be null
      * @throws IllegalArgumentException if map or factory is null
      */
-    public static <K, V> SortedMap<K, V> lazySortedMap(SortedMap<K, V> map, Transformer<? super K, ? extends V> factory) {
+    public static <K, V> LazySortedMap<K, V> lazySortedMap(SortedMap<K, V> map,
+                                                           Transformer<? super K, ? extends V> factory) {
         return new LazySortedMap<K,V>(map, factory);
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ListOrderedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ListOrderedMap.java?rev=1353132&r1=1353131&r2=1353132&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ListOrderedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ListOrderedMap.java Sat Jun 23 14:33:48 2012
@@ -96,7 +96,7 @@ public class ListOrderedMap<K, V>
      * @param map  the map to decorate, must not be null
      * @throws IllegalArgumentException if map is null
      */
-    public static <K, V> OrderedMap<K, V> listOrderedMap(Map<K, V> map) {
+    public static <K, V> ListOrderedMap<K, V> listOrderedMap(Map<K, V> map) {
         return new ListOrderedMap<K, V>(map);
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java?rev=1353132&r1=1353131&r2=1353132&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java Sat Jun 23 14:33:48 2012
@@ -95,7 +95,8 @@ public class MultiValueMap<K, V> extends
      * @param map  the map to wrap
      * @param collectionClass  the type of the collection class
      */
-    public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(Map<K, ? super C> map, Class<C> collectionClass) {
+    public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(Map<K, ? super C> map,
+                                                                                    Class<C> collectionClass) {
         return new MultiValueMap<K, V>(map, new ReflectionFactory<C>(collectionClass));
     }
 
@@ -106,7 +107,8 @@ public class MultiValueMap<K, V> extends
      * @param map  the map to decorate
      * @param collectionFactory  the collection factory (must return a Collection object).
      */
-    public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(Map<K, ? super C> map, Factory<C> collectionFactory) {
+    public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(Map<K, ? super C> map,
+                                                                                    Factory<C> collectionFactory) {
         return new MultiValueMap<K, V>(map, collectionFactory);
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedMap.java?rev=1353132&r1=1353131&r2=1353132&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedMap.java Sat Jun 23 14:33:48 2012
@@ -75,7 +75,9 @@ public class PredicatedMap<K, V>
      * @param valuePredicate  the predicate to validate to values, null means no check
      * @throws IllegalArgumentException if the map is null
      */
-    public static <K, V> IterableMap<K, V> predicatedMap(Map<K, V> map, Predicate<? super K> keyPredicate, Predicate<? super V> valuePredicate) {
+    public static <K, V> PredicatedMap<K, V> predicatedMap(Map<K, V> map,
+                                                           Predicate<? super K> keyPredicate,
+                                                           Predicate<? super V> valuePredicate) {
         return new PredicatedMap<K, V>(map, keyPredicate, valuePredicate);
     }
 

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java?rev=1353132&r1=1353131&r2=1353132&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java Sat Jun 23 14:33:48 2012
@@ -62,7 +62,7 @@ public class PredicatedSortedMap<K, V> e
      * @param valuePredicate  the predicate to validate to values, null means no check
      * @throws IllegalArgumentException if the map is null
      */
-    public static <K, V> SortedMap<K, V> predicatedSortedMap(SortedMap<K, V> map,
+    public static <K, V> PredicatedSortedMap<K, V> predicatedSortedMap(SortedMap<K, V> map,
             Predicate<? super K> keyPredicate, Predicate<? super V> valuePredicate) {
         return new PredicatedSortedMap<K, V>(map, keyPredicate, valuePredicate);
     }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedMap.java?rev=1353132&r1=1353131&r2=1353132&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedMap.java Sat Jun 23 14:33:48 2012
@@ -72,7 +72,7 @@ public class TransformedMap<K, V>
      * @param valueTransformer  the transformer to use for value conversion, null means no transformation
      * @throws IllegalArgumentException if map is null
      */
-    public static <K, V> IterableMap<K, V> transformingMap(Map<K, V> map,
+    public static <K, V> TransformedMap<K, V> transformingMap(Map<K, V> map,
             Transformer<? super K, ? extends K> keyTransformer,
             Transformer<? super V, ? extends V> valueTransformer) {
         return new TransformedMap<K, V>(map, keyTransformer, valueTransformer);
@@ -92,7 +92,7 @@ public class TransformedMap<K, V>
      * @throws IllegalArgumentException if map is null
      * @since Commons Collections 3.2
      */
-    public static <K, V> Map<K, V> transformedMap(Map<K, V> map,
+    public static <K, V> TransformedMap<K, V> transformedMap(Map<K, V> map,
             Transformer<? super K, ? extends K> keyTransformer,
             Transformer<? super V, ? extends V> valueTransformer) {
         TransformedMap<K, V> decorated = new TransformedMap<K, V>(map, keyTransformer, valueTransformer);

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java?rev=1353132&r1=1353131&r2=1353132&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java Sat Jun 23 14:33:48 2012
@@ -62,7 +62,7 @@ public class TransformedSortedMap<K, V>
      * @param valueTransformer  the predicate to validate to values, null means no transformation
      * @throws IllegalArgumentException if the map is null
      */
-    public static <K, V> SortedMap<K, V> transformingSortedMap(SortedMap<K, V> map,
+    public static <K, V> TransformedSortedMap<K, V> transformingSortedMap(SortedMap<K, V> map,
             Transformer<? super K, ? extends K> keyTransformer,
             Transformer<? super V, ? extends V> valueTransformer) {
         return new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
@@ -82,7 +82,7 @@ public class TransformedSortedMap<K, V>
      * @throws IllegalArgumentException if map is null
      * @since Commons Collections 3.2
      */
-    public static <K, V> SortedMap<K, V> transformedSortedMap(SortedMap<K, V> map,
+    public static <K, V> TransformedSortedMap<K, V> transformedSortedMap(SortedMap<K, V> map,
             Transformer<? super K, ? extends K> keyTransformer,
             Transformer<? super V, ? extends V> valueTransformer) {
         TransformedSortedMap<K, V> decorated = new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);