You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2005/05/22 19:48:57 UTC
svn commit: r171349 - in /jakarta/commons/proper/collections/trunk:
RELEASE-NOTES.html project.xml
src/java/org/apache/commons/collections/map/AbstractHashedMap.java
src/test/org/apache/commons/collections/map/TestHashedMap.java
Author: scolebourne
Date: Sun May 22 10:48:56 2005
New Revision: 171349
URL: http://svn.apache.org/viewcvs?rev=171349&view=rev
Log:
Fix AbstractHeashedMap initialization to calculate correct threshold
bug 35012, by Christian Siefkes
Modified:
jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html
jakarta/commons/proper/collections/trunk/project.xml
jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestHashedMap.java
Modified: jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html?rev=171349&r1=171348&r2=171349&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html (original)
+++ jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html Sun May 22 10:48:56 2005
@@ -71,6 +71,7 @@
<li>AbstractHashedMap deserialization - Fix to prevent doubling of internal data array [34265]</li>
<li>Flat3Map.equals() - Fix to make flat mode comparison actually work [34917]</li>
<li>IteratorChain.remove() - Fix to avoid IllegalStateException when one of the underlying iterators is a FilterIterator [34267]</li>
+<li>AbstractHashedMap initialization - Fix to setup threshold correctly, improving performance [35012]</li>
</ul>
<center><h3>JAVADOC</h3></center>
Modified: jakarta/commons/proper/collections/trunk/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/project.xml?rev=171349&r1=171348&r2=171349&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/project.xml (original)
+++ jakarta/commons/proper/collections/trunk/project.xml Sun May 22 10:48:56 2005
@@ -285,6 +285,9 @@
<name>Jon Schewe</name>
</contributor>
<contributor>
+ <name>Christian Siefkes</name>
+ </contributor>
+ <contributor>
<name>Michael Smith</name>
</contributor>
<contributor>
Modified: jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java?rev=171349&r1=171348&r2=171349&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java (original)
+++ jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java Sun May 22 10:48:56 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2004 The Apache Software Foundation
+ * Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,6 +56,7 @@
*
* @author java util HashMap
* @author Stephen Colebourne
+ * @author Christian Siefkes
*/
public class AbstractHashedMap extends AbstractMap implements IterableMap {
@@ -145,8 +146,8 @@
throw new IllegalArgumentException("Load factor must be greater than 0");
}
this.loadFactor = loadFactor;
- this.threshold = calculateThreshold(initialCapacity, loadFactor);
initialCapacity = calculateNewCapacity(initialCapacity);
+ this.threshold = calculateThreshold(initialCapacity, loadFactor);
this.data = new HashEntry[initialCapacity];
init();
}
Modified: jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestHashedMap.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestHashedMap.java?rev=171349&r1=171348&r2=171349&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestHashedMap.java (original)
+++ jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestHashedMap.java Sun May 22 10:48:56 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2004 The Apache Software Foundation
+ * Copyright 2001-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,7 +58,16 @@
assertEquals(map.size(), cloned.size());
assertSame(map.get("1"), cloned.get("1"));
}
-
+
+ public void testInternalState() {
+ HashedMap map = new HashedMap(42, 0.75f);
+ assertEquals(0.75f, map.loadFactor, 0.1f);
+ assertEquals(0, map.size);
+ assertEquals(64, map.data.length);
+ assertEquals(48, map.threshold);
+ assertEquals(0, map.modCount);
+ }
+
// public void testCreate() throws Exception {
// resetEmpty();
// writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/HashedMap.emptyCollection.version3.obj");
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org