scolebourne 2003/01/18 05:37:12
Modified: collections/src/java/org/apache/commons/collections
FastHashMap.java
Log:
Update clear() methods to run faster
Revision Changes Path
1.12 +5 -8
jakarta-commons/collections/src/java/org/apache/commons/collections/FastHashMap.java
Index: FastHashMap.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/FastHashMap.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- FastHashMap.java 18 Jan 2003 12:47:34 -0000 1.11
+++ FastHashMap.java 18 Jan 2003 13:37:12 -0000 1.12
@@ -102,6 +102,7 @@
* @version $Revision$ $Date$
*
* @author Craig R. McClanahan
+ * @author Stephen Colebourne
*/
public class FastHashMap extends HashMap {
@@ -346,9 +347,7 @@
public void clear() {
if (fast) {
synchronized (this) {
- HashMap temp = (HashMap) map.clone();
- temp.clear();
- map = temp;
+ map = new HashMap();
}
} else {
synchronized (map) {
@@ -514,9 +513,7 @@
public void clear() {
if (fast) {
synchronized (FastHashMap.this) {
- HashMap temp = (HashMap) map.clone();
- get(temp).clear();
- map = temp;
+ map = new HashMap();
}
} else {
synchronized (map) {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>