[cp-patches] [PATCH] Bump up HashMap default initial capacity
While debugging Jython bootstrap issues with GNU Classpath, I noticed that HashMap.DEFAULT_CAPACITY is set to 11 although 1.4 Javadocs, for example, define it to be 16. Signed-off-by: Pekka Enberg penb...@kernel.org --- ChangeLog |6 ++ java/util/HashMap.java |5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1c7c31..7eeacf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-02-22 Pekka Enberg penb...@kernel.org + + * java/util/HashMap: + (DEFAULT_CAPACITY): Make default initial capacity 16 as it is + defined in official Javadocs. + 2010-02-16 Pekka Enberg penb...@kernel.org * java/util/Formatter.java: diff --git a/java/util/HashMap.java b/java/util/HashMap.java index 55d81c6..108bf25 100644 --- a/java/util/HashMap.java +++ b/java/util/HashMap.java @@ -100,11 +100,10 @@ public class HashMapK, V extends AbstractMapK, V implements MapK, V, Cloneable, Serializable { /** - * Default number of buckets. This is the value the JDK 1.3 uses. Some - * early documentation specified this value as 101. That is incorrect. + * Default number of buckets; this is explicitly specified by the spec. * Package visible for use by HashSet. */ - static final int DEFAULT_CAPACITY = 11; + static final int DEFAULT_CAPACITY = 16; /** * The default load factor; this is explicitly specified by the spec. -- 1.7.1
Re: [cp-patches] [PATCH] Bump up HashMap default initial capacity
On Tue, 2011-02-22 at 16:58 +0200, Pekka Enberg wrote: While debugging Jython bootstrap issues with GNU Classpath, I noticed that HashMap.DEFAULT_CAPACITY is set to 11 although 1.4 Javadocs, for example, define it to be 16. Signed-off-by: Pekka Enberg penb...@kernel.org /** - * Default number of buckets. This is the value the JDK 1.3 uses. Some - * early documentation specified this value as 101. That is incorrect. + * Default number of buckets; this is explicitly specified by the spec. * Package visible for use by HashSet. */ - static final int DEFAULT_CAPACITY = 11; + static final int DEFAULT_CAPACITY = 16; Just say this is currently set to 16. Since obviously the spec changed a bit over time. The actual change seems OK. Thanks, Mark
Re: [cp-patches] [PATCH] Bump up HashMap default initial capacity
On 16:07 Tue 22 Feb , Mark Wielaard wrote: On Tue, 2011-02-22 at 16:58 +0200, Pekka Enberg wrote: While debugging Jython bootstrap issues with GNU Classpath, I noticed that HashMap.DEFAULT_CAPACITY is set to 11 although 1.4 Javadocs, for example, define it to be 16. Signed-off-by: Pekka Enberg penb...@kernel.org /** - * Default number of buckets. This is the value the JDK 1.3 uses. Some - * early documentation specified this value as 101. That is incorrect. + * Default number of buckets; this is explicitly specified by the spec. * Package visible for use by HashSet. */ - static final int DEFAULT_CAPACITY = 11; + static final int DEFAULT_CAPACITY = 16; Just say this is currently set to 16. Since obviously the spec changed a bit over time. I agree with this. Not only does the spec. change, but then the user has to work out what 'the spec' refers to and go check it. Much easier to just say 'currently set to 16'. The actual change seems OK. Thanks, Mark -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and IcedTea http://www.gnu.org/software/classpath http://icedtea.classpath.org PGP Key: F5862A37 (https://keys.indymedia.org/) Fingerprint = EA30 D855 D50F 90CD F54D 0698 0713 C3ED F586 2A37