Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 35681 invoked from network); 24 Dec 2004 11:03:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 24 Dec 2004 11:03:58 -0000 Received: (qmail 51015 invoked by uid 500); 24 Dec 2004 11:03:49 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 50918 invoked by uid 500); 24 Dec 2004 11:03:48 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 50883 invoked by uid 500); 24 Dec 2004 11:03:47 -0000 Received: (qmail 50877 invoked by uid 99); 24 Dec 2004 11:03:47 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 24 Dec 2004 03:03:46 -0800 Received: (qmail 35478 invoked by uid 1529); 24 Dec 2004 11:03:45 -0000 Date: 24 Dec 2004 11:03:45 -0000 Message-ID: <20041224110345.35477.qmail@minotaur.apache.org> From: scolebourne@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestMapUtils.java TestListUtils.java TestCollectionUtils.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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. - *

- * This method uses the unmodifiable list implementation in the decorators subpackage. - * @param collection the Collection to copy. - * @return an unmodifiable List. - * @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. *

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. - *

- * This method uses the implementation in the decorators subpackage. - * - * @param collection the Collection to copy. - * @return an unmodifiable Collection. - * @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. *

* 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