2001-03-24 Bryce McKinlay <bryce@albatross.co.nz>
* java/util/HashMap.java (HashMap): If 0 is given for initialCapacity
paramater, bump it to 1.
* java/util/Hashtable.java (Hashtable): Likewise.
From-SVN: r40812
+2001-03-24 Bryce McKinlay <bryce@albatross.co.nz>
+
+ * java/util/HashMap.java (HashMap): If 0 is given for initialCapacity
+ paramater, bump it to 1.
+ * java/util/Hashtable.java (Hashtable): Likewise.
+
2001-03-23 Per Bothner <per@bothner.com>
* java/lang/natDouble.cc (parseDouble): Cannot use errno to
* @param loadFactor the load factor
*
* @throws IllegalArgumentException if (initialCapacity < 0) ||
- * (initialLoadFactor > 1.0) ||
+ * (loadFactor <= 0)
*/
public HashMap(int initialCapacity, float loadFactor)
throws IllegalArgumentException
+ initialCapacity);
if (loadFactor <= 0)
throw new IllegalArgumentException("Illegal Load Factor: " + loadFactor);
-
+
+ if (initialCapacity == 0)
+ initialCapacity = 1;
buckets = new Entry[initialCapacity];
this.loadFactor = loadFactor;
this.threshold = (int) (initialCapacity * loadFactor);
+ initialCapacity);
if (loadFactor <= 0)
throw new IllegalArgumentException("Illegal Load Factor: " + loadFactor);
-
+
+ if (initialCapacity == 0)
+ initialCapacity = 1;
buckets = new Entry[initialCapacity];
this.loadFactor = loadFactor;
this.threshold = (int) (initialCapacity * loadFactor);