commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestMapUtils.java TestListUtils.java TestCollectionUtils.java
Date Fri, 24 Dec 2004 11:03:45 GMT
scolebourne    2004/12/24 03:03:45

  Modified:    collections/src/java/org/apache/commons/collections
                        MapUtils.java ListUtils.java CollectionUtils.java
               collections/src/test/org/apache/commons/collections
                        TestMapUtils.java TestListUtils.java
                        TestCollectionUtils.java
  Log:
  Remove unmodifiableXxxCopy methods as they don't add enough value
  
  Revision  Changes    Path
  1.52      +1 -15     jakarta-commons/collections/src/java/org/apache/commons/collections/MapUtils.java
  
  Index: MapUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/MapUtils.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- MapUtils.java	19 Dec 2004 16:56:30 -0000	1.51
  +++ MapUtils.java	24 Dec 2004 11:03:44 -0000	1.52
  @@ -1221,20 +1221,6 @@
       public static Map unmodifiableMap(Map map) {
           return UnmodifiableMap.decorate(map);
       }
  -    
  -    /**
  -     * Returns an unmodifiable copy of the map.
  -     * @param map  the map to make an unmodifiable copy of, must not be null
  -     * @return an unmodifiable map backed by the given map
  -     * @throws IllegalArgumentException  if the map is null
  -     */
  -    public static Map unmodifiableMapCopy(Map map) {
  -        if (map == null) throw new IllegalArgumentException("null not permitted.");
  -        
  -        Map copy = new HashMap(map.size(), 1.0f);
  -        copy.putAll(map);
  -        return MapUtils.unmodifiableMap(copy);
  -    }
   
       /**
        * Returns a predicated (validating) map backed by the given map.
  
  
  
  1.31      +1 -18     jakarta-commons/collections/src/java/org/apache/commons/collections/ListUtils.java
  
  Index: ListUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ListUtils.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- ListUtils.java	19 Dec 2004 16:56:30 -0000	1.30
  +++ ListUtils.java	24 Dec 2004 11:03:45 -0000	1.31
  @@ -258,23 +258,6 @@
           return UnmodifiableList.decorate(list);
       }
   
  -    
  -    /**
  -     * Returns an unmodifiable list copy of the collection.
  -     * <p>
  -     * This method uses the unmodifiable list implementation in the decorators subpackage.
  -     * @param collection the <code>Collection</code> to copy.
  -     * @return an unmodifiable <code>List</code>.
  -     * @throws IllegalArgumentException if collection is null.
  -     */
  -    public static List unmodifiableListCopy(final Collection collection) {
  -        if (collection == null) throw new IllegalArgumentException("null not permitted.");
  -        
  -        final List copy = new ArrayList(collection.size());
  -        copy.addAll(collection);
  -        return UnmodifiableList.decorate(copy);
  -    }
  -    
       /**
        * Returns a predicated (validating) list backed by the given list.
        * <p>
  
  
  
  1.65      +1 -18     jakarta-commons/collections/src/java/org/apache/commons/collections/CollectionUtils.java
  
  Index: CollectionUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/CollectionUtils.java,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- CollectionUtils.java	19 Dec 2004 16:56:30 -0000	1.64
  +++ CollectionUtils.java	24 Dec 2004 11:03:45 -0000	1.65
  @@ -1050,23 +1050,6 @@
       }
   
       /**
  -     * Returns an unmodifiable copy of the collection.
  -     * <p>
  -     * This method uses the implementation in the decorators subpackage.
  -     * 
  -     * @param collection the <code>Collection</code> to copy.
  -     * @return an unmodifiable <code>Collection</code>.
  -     * @throws IllegalArgumentException if collection is null
  -     */
  -    public static Collection unmodifiableCollectionCopy(final Collection collection){
  -        if (collection == null) throw new IllegalArgumentException("null not permitted.");
  -        
  -        final Collection copy = new ArrayList(collection.size());
  -        copy.addAll(collection);
  -        return UnmodifiableCollection.decorate(copy);
  -    }
  -
  -    /**
        * Returns a predicated (validating) collection backed by the given collection.
        * <p>
        * Only objects that pass the test in the given predicate can be added to the collection.
  
  
  
  1.27      +1 -27     jakarta-commons/collections/src/test/org/apache/commons/collections/TestMapUtils.java
  
  Index: TestMapUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMapUtils.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- TestMapUtils.java	19 Dec 2004 16:56:31 -0000	1.26
  +++ TestMapUtils.java	24 Dec 2004 11:03:45 -0000	1.27
  @@ -771,30 +771,4 @@
           assertEquals(EXPECTED_OUT, out.toString());
       }
       
  -    public void testUnmodifiableMapCopy() {
  -        Map map = new HashMap();
  -        map.put("key", "value");
  -
  -        Map copy = MapUtils.unmodifiableMapCopy(map);
  -        assertTrue(copy instanceof Unmodifiable);
  -        assertEquals(map, copy);
  -        map.clear();
  -        assertFalse(map.equals(copy));
  -
  -        try {
  -            copy.clear();
  -            fail("should be unmodifiable.");
  -        } catch (UnsupportedOperationException uoe) {
  -            // this is what we want
  -        }
  -        
  -        try {
  -            map = MapUtils.unmodifiableMapCopy(null);
  -            fail("expecting IllegalArgumentException");
  -        } catch (IllegalArgumentException iae) {
  -            // this is what we want
  -        }
  -
  -    }
  -
   }
  
  
  
  1.22      +1 -26     jakarta-commons/collections/src/test/org/apache/commons/collections/TestListUtils.java
  
  Index: TestListUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestListUtils.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- TestListUtils.java	19 Dec 2004 16:56:31 -0000	1.21
  +++ TestListUtils.java	24 Dec 2004 11:03:45 -0000	1.22
  @@ -136,31 +136,6 @@
           assertEquals(0, ListUtils.hashCodeForList(null));
       }
       
  -    public void testUnmodifiableListCopy() {
  -        List list = new ArrayList();
  -        list.add("a");
  -        List copy = ListUtils.unmodifiableListCopy(list);
  -
  -        assertTrue(copy instanceof Unmodifiable);
  -        assertTrue(list.equals(copy));
  -        list.clear();
  -        assertTrue(copy.isEmpty() == false);
  -
  -        try {
  -            copy.clear();
  -            fail("should be unmodifiable.");
  -        } catch (UnsupportedOperationException uoe) {
  -            // this is what we want
  -        }
  -        
  -        try {
  -            list = ListUtils.unmodifiableListCopy(null);
  -            fail("expecting IllegalArgumentException");
  -        } catch (IllegalArgumentException iae) {
  -            // this is what we want
  -        }
  -    }
  -    
       public void testRetainAll() {
           List sub = new ArrayList();
           sub.add(a);
  
  
  
  1.44      +1 -24     jakarta-commons/collections/src/test/org/apache/commons/collections/TestCollectionUtils.java
  
  Index: TestCollectionUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestCollectionUtils.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- TestCollectionUtils.java	19 Dec 2004 16:56:31 -0000	1.43
  +++ TestCollectionUtils.java	24 Dec 2004 11:03:45 -0000	1.44
  @@ -1196,27 +1196,4 @@
           }  
       }
       
  -    public void testUnmodifiableCollectionCopy() {
  -        Collection collection = new ArrayList();
  -        collection.add("a");
  -        Collection copy = CollectionUtils.unmodifiableCollectionCopy(collection);
  -
  -        assertTrue(copy instanceof Unmodifiable);
  -        assertTrue(CollectionUtils.isEqualCollection(collection, copy));
  -        collection.clear();
  -        assertTrue(copy.isEmpty() == false);
  -
  -        try {
  -			copy.clear();
  -			fail("should be unmodifiable.");
  -		} catch (UnsupportedOperationException uoe) {
  -		} // this is what we want
  -
  -		try {
  -			copy = CollectionUtils.unmodifiableCollectionCopy(null);
  -			fail("should throw IllegalArgumentException");
  -		} catch (IllegalArgumentException iae) {
  -		}
  -    }
  -    
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message