Author: jochen Date: Tue Mar 8 23:37:01 2011 New Revision: 1079602 URL: http://svn.apache.org/viewvc?rev=1079602&view=rev Log: PR: COLLECTIONS-323 Submitted-By: Maarten Brak <maarten.b...@quinity.com> Allow to use an initial capacity of 0 on certain maps.
Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/pom.xml commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/AbstractHashedMap.java commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/HashedMap.java commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/IdentityMap.java commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/LinkedMap.java commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestHashedMap.java commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestIdentityMap.java commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestLinkedMap.java commons/proper/collections/trunk/pom.xml commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/HashedMap.java commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/IdentityMap.java commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LinkedMap.java commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestHashedMap.java commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestIdentityMap.java commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestLinkedMap.java Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/pom.xml?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/pom.xml (original) +++ commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/pom.xml Tue Mar 8 23:37:01 2011 @@ -148,12 +148,15 @@ <name>Janek Bogucki</name> </contributor> <contributor> - <name>Chuck Burdick</name> + <name>Maarten Brak</name> </contributor> <contributor> <name>Dave Bryson</name> </contributor> <contributor> + <name>Chuck Burdick</name> + </contributor> + <contributor> <name>Julien Buret</name> </contributor> <contributor> Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/AbstractHashedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/AbstractHashedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/AbstractHashedMap.java (original) +++ commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/AbstractHashedMap.java Tue Mar 8 23:37:01 2011 @@ -123,7 +123,7 @@ public class AbstractHashedMap extends A * default load factor. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ protected AbstractHashedMap(int initialCapacity) { this(initialCapacity, DEFAULT_LOAD_FACTOR); @@ -135,13 +135,13 @@ public class AbstractHashedMap extends A * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one - * @throws IllegalArgumentException if the load factor is less than or equal to zero + * @throws IlleagalArgumentException if the initial capacity is negative + * @throws IllegalArgumentException if the load factor is less than or equal to zero */ protected AbstractHashedMap(int initialCapacity, float loadFactor) { super(); - if (initialCapacity < 1) { - throw new IllegalArgumentException("Initial capacity must be greater than 0"); + if (initialCapacity < 0) { + throw new IllegalArgumentException("Initial capacity must be a non negative number"); } if (loadFactor <= 0.0f || Float.isNaN(loadFactor)) { throw new IllegalArgumentException("Load factor must be greater than 0"); Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java (original) +++ commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java Tue Mar 8 23:37:01 2011 @@ -90,7 +90,7 @@ public class AbstractLinkedMap extends A * Constructs a new, empty map with the specified initial capacity. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ protected AbstractLinkedMap(int initialCapacity) { super(initialCapacity); @@ -102,7 +102,7 @@ public class AbstractLinkedMap extends A * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative * @throws IllegalArgumentException if the load factor is less than zero */ protected AbstractLinkedMap(int initialCapacity, float loadFactor) { Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java (original) +++ commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java Tue Mar 8 23:37:01 2011 @@ -78,7 +78,7 @@ public class CaseInsensitiveMap extends * Constructs a new, empty map with the specified initial capacity. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ public CaseInsensitiveMap(int initialCapacity) { super(initialCapacity); @@ -90,7 +90,7 @@ public class CaseInsensitiveMap extends * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative * @throws IllegalArgumentException if the load factor is less than zero */ public CaseInsensitiveMap(int initialCapacity, float loadFactor) { Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/HashedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/HashedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/HashedMap.java (original) +++ commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/HashedMap.java Tue Mar 8 23:37:01 2011 @@ -58,7 +58,7 @@ public class HashedMap * Constructs a new, empty map with the specified initial capacity. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ public HashedMap(int initialCapacity) { super(initialCapacity); @@ -70,7 +70,7 @@ public class HashedMap * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative * @throws IllegalArgumentException if the load factor is less than zero */ public HashedMap(int initialCapacity, float loadFactor) { Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/IdentityMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/IdentityMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/IdentityMap.java (original) +++ commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/IdentityMap.java Tue Mar 8 23:37:01 2011 @@ -60,7 +60,7 @@ public class IdentityMap * Constructs a new, empty map with the specified initial capacity. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ public IdentityMap(int initialCapacity) { super(initialCapacity); @@ -72,7 +72,7 @@ public class IdentityMap * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative * @throws IllegalArgumentException if the load factor is less than zero */ public IdentityMap(int initialCapacity, float loadFactor) { Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/LinkedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/LinkedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/LinkedMap.java (original) +++ commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/java/org/apache/commons/collections/map/LinkedMap.java Tue Mar 8 23:37:01 2011 @@ -79,7 +79,7 @@ public class LinkedMap * Constructs a new, empty map with the specified initial capacity. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ public LinkedMap(int initialCapacity) { super(initialCapacity); @@ -91,7 +91,7 @@ public class LinkedMap * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative * @throws IllegalArgumentException if the load factor is less than zero */ public LinkedMap(int initialCapacity, float loadFactor) { Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java (original) +++ commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java Tue Mar 8 23:37:01 2011 @@ -117,4 +117,12 @@ public class TestCaseInsensitiveMap exte writeExternalFormToDisk((java.io.Serializable) map, "/home/phil/jakarta-commons/collections/data/test/CaseInsensitiveMap.fullCollection.version3.obj"); } */ + + /** + * Test for <a href="https://issues.apache.org/jira/browse/COLLECTIONS-323">COLLECTIONS-323</a>. + */ + public void testInitialCapacityZero() { + final CaseInsensitiveMap map = new CaseInsensitiveMap(0); + assertEquals(1, map.data.length); + } } Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestHashedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestHashedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestHashedMap.java (original) +++ commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestHashedMap.java Tue Mar 8 23:37:01 2011 @@ -75,4 +75,12 @@ public class TestHashedMap extends Abstr // resetFull(); // writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/HashedMap.fullCollection.version3.obj"); // } + + /** + * Test for <a href="https://issues.apache.org/jira/browse/COLLECTIONS-323">COLLECTIONS-323</a>. + */ + public void testInitialCapacityZero() { + final HashedMap map = new HashedMap(0); + assertEquals(1, map.data.length); + } } Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestIdentityMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestIdentityMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestIdentityMap.java (original) +++ commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestIdentityMap.java Tue Mar 8 23:37:01 2011 @@ -143,4 +143,12 @@ public class TestIdentityMap extends Abs // map.put(I2A, I2B); // writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/IdentityMap.fullCollection.version3.obj"); // } + + /** + * Test for <a href="https://issues.apache.org/jira/browse/COLLECTIONS-323">COLLECTIONS-323</a>. + */ + public void testInitialCapacityZero() { + final IdentityMap map = new IdentityMap(0); + assertEquals(1, map.data.length); + } } Modified: commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestLinkedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestLinkedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestLinkedMap.java (original) +++ commons/proper/collections/branches/COLLECTIONS_3_2_BRANCH/src/test/org/apache/commons/collections/map/TestLinkedMap.java Tue Mar 8 23:37:01 2011 @@ -272,4 +272,12 @@ public class TestLinkedMap extends Abstr // resetFull(); // writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/LinkedMap.fullCollection.version3.obj"); // } + + /** + * Test for <a href="https://issues.apache.org/jira/browse/COLLECTIONS-323">COLLECTIONS-323</a>. + */ + public void testInitialCapacityZero() { + final LinkedMap map = new LinkedMap(0); + assertEquals(1, map.data.length); + } } Modified: commons/proper/collections/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/pom.xml?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/trunk/pom.xml (original) +++ commons/proper/collections/trunk/pom.xml Tue Mar 8 23:37:01 2011 @@ -129,12 +129,15 @@ <name>Janek Bogucki</name> </contributor> <contributor> - <name>Chuck Burdick</name> + <name>Maarten Brak</name> </contributor> <contributor> <name>Dave Bryson</name> </contributor> <contributor> + <name>Chuck Burdick</name> + </contributor> + <contributor> <name>Julien Buret</name> </contributor> <contributor> Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java (original) +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java Tue Mar 8 23:37:01 2011 @@ -124,7 +124,7 @@ public class AbstractHashedMap<K, V> ext * default load factor. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ protected AbstractHashedMap(int initialCapacity) { this(initialCapacity, DEFAULT_LOAD_FACTOR); @@ -136,14 +136,14 @@ public class AbstractHashedMap<K, V> ext * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one - * @throws IllegalArgumentException if the load factor is less than or equal to zero + * @throws IlleagalArgumentException if the initial capacity is negative + * @throws IllegalArgumentException if the load factor is less than or equal to zero */ @SuppressWarnings("unchecked") protected AbstractHashedMap(int initialCapacity, float loadFactor) { super(); - if (initialCapacity < 1) { - throw new IllegalArgumentException("Initial capacity must be greater than 0"); + if (initialCapacity < 0) { + throw new IllegalArgumentException("Initial capacity must be a non negative number"); } if (loadFactor <= 0.0f || Float.isNaN(loadFactor)) { throw new IllegalArgumentException("Load factor must be greater than 0"); Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java (original) +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java Tue Mar 8 23:37:01 2011 @@ -89,7 +89,7 @@ public abstract class AbstractLinkedMap< * Constructs a new, empty map with the specified initial capacity. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ protected AbstractLinkedMap(int initialCapacity) { super(initialCapacity); @@ -101,7 +101,7 @@ public abstract class AbstractLinkedMap< * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative * @throws IllegalArgumentException if the load factor is less than zero */ protected AbstractLinkedMap(int initialCapacity, float loadFactor) { Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java (original) +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/CaseInsensitiveMap.java Tue Mar 8 23:37:01 2011 @@ -78,7 +78,7 @@ public class CaseInsensitiveMap<K, V> ex * Constructs a new, empty map with the specified initial capacity. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ public CaseInsensitiveMap(int initialCapacity) { super(initialCapacity); @@ -90,7 +90,7 @@ public class CaseInsensitiveMap<K, V> ex * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative * @throws IllegalArgumentException if the load factor is less than zero */ public CaseInsensitiveMap(int initialCapacity, float loadFactor) { Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/HashedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/HashedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/HashedMap.java (original) +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/HashedMap.java Tue Mar 8 23:37:01 2011 @@ -58,7 +58,7 @@ public class HashedMap<K, V> * Constructs a new, empty map with the specified initial capacity. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ public HashedMap(int initialCapacity) { super(initialCapacity); @@ -70,7 +70,7 @@ public class HashedMap<K, V> * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative * @throws IllegalArgumentException if the load factor is less than zero */ public HashedMap(int initialCapacity, float loadFactor) { Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/IdentityMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/IdentityMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/IdentityMap.java (original) +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/IdentityMap.java Tue Mar 8 23:37:01 2011 @@ -60,7 +60,7 @@ public class IdentityMap<K, V> * Constructs a new, empty map with the specified initial capacity. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ public IdentityMap(int initialCapacity) { super(initialCapacity); @@ -72,7 +72,7 @@ public class IdentityMap<K, V> * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative * @throws IllegalArgumentException if the load factor is less than zero */ public IdentityMap(int initialCapacity, float loadFactor) { Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LinkedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LinkedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LinkedMap.java (original) +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LinkedMap.java Tue Mar 8 23:37:01 2011 @@ -78,7 +78,7 @@ public class LinkedMap<K, V> extends Abs * Constructs a new, empty map with the specified initial capacity. * * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative */ public LinkedMap(int initialCapacity) { super(initialCapacity); @@ -90,7 +90,7 @@ public class LinkedMap<K, V> extends Abs * * @param initialCapacity the initial capacity * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one + * @throws IllegalArgumentException if the initial capacity is negative * @throws IllegalArgumentException if the load factor is less than zero */ public LinkedMap(int initialCapacity, float loadFactor) { Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java (original) +++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java Tue Mar 8 23:37:01 2011 @@ -146,4 +146,11 @@ public class TestCaseInsensitiveMap<K, V } } + /** + * Test for <a href="https://issues.apache.org/jira/browse/COLLECTIONS-323">COLLECTIONS-323</a>. + */ + public void testInitialCapacityZero() { + final CaseInsensitiveMap<String,String> map = new CaseInsensitiveMap<String,String>(0); + assertEquals(1, map.data.length); + } } Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestHashedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestHashedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestHashedMap.java (original) +++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestHashedMap.java Tue Mar 8 23:37:01 2011 @@ -70,4 +70,12 @@ public class TestHashedMap<K, V> extends // resetFull(); // writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/HashedMap.fullCollection.version3.obj"); // } + + /** + * Test for <a href="https://issues.apache.org/jira/browse/COLLECTIONS-323">COLLECTIONS-323</a>. + */ + public void testInitialCapacityZero() { + final HashedMap<String,String> map = new HashedMap<String,String>(0); + assertEquals(1, map.data.length); + } } Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestIdentityMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestIdentityMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestIdentityMap.java (original) +++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestIdentityMap.java Tue Mar 8 23:37:01 2011 @@ -143,4 +143,12 @@ public class TestIdentityMap<K, V> exten // map.put(I2A, I2B); // writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/IdentityMap.fullCollection.version3.obj"); // } + + /** + * Test for <a href="https://issues.apache.org/jira/browse/COLLECTIONS-323">COLLECTIONS-323</a>. + */ + public void testInitialCapacityZero() { + final IdentityMap<String,String> map = new IdentityMap<String,String>(0); + assertEquals(1, map.data.length); + } } Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestLinkedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestLinkedMap.java?rev=1079602&r1=1079601&r2=1079602&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestLinkedMap.java (original) +++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestLinkedMap.java Tue Mar 8 23:37:01 2011 @@ -295,4 +295,12 @@ public class TestLinkedMap<K, V> extends public LinkedMap<K, V> getMap() { return (LinkedMap<K, V>) super.getMap(); } + + /** + * Test for <a href="https://issues.apache.org/jira/browse/COLLECTIONS-323">COLLECTIONS-323</a>. + */ + public void testInitialCapacityZero() { + final LinkedMap<String,String> map = new LinkedMap<String,String>(0); + assertEquals(1, map.data.length); + } }