--- src/EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap.java	2007-09-11 14:32:37.000000000 +0200
+++ /home/ejort/temp/ConcurrentHashMap.java	2005-07-15 20:47:11.000000000 +0200
@@ -19,20 +19,22 @@
   Date       Who                What
   26nov2000  dl               Created, based on ConcurrentReaderHashMap
   12jan2001  dl               public release
   17nov2001  dl               Minor tunings
   24oct2003  dl               Segment implements Serializable
+  23jun2004  dl               Avoid bad array sizings in view toArray methods
 */
 
 package EDU.oswego.cs.dl.util.concurrent;
 
 import java.util.Map;
 import java.util.AbstractMap;
 import java.util.AbstractSet;
 import java.util.AbstractCollection;
 import java.util.Collection;
 import java.util.Set;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.Enumeration;
 import java.util.NoSuchElementException;
 
 import java.io.Serializable;
@@ -877,10 +879,22 @@
       return ConcurrentHashMap.this.remove(o) != null;
     }
     public void clear() {
       ConcurrentHashMap.this.clear();
     }
+    public Object[] toArray() {
+      Collection c = new ArrayList();
+      for (Iterator i = iterator(); i.hasNext(); )
+          c.add(i.next());
+      return c.toArray();
+    }
+    public Object[] toArray(Object[] a) {
+      Collection c = new ArrayList();
+      for (Iterator i = iterator(); i.hasNext(); )
+          c.add(i.next());
+      return c.toArray(a);
+    }
   }
 
   /**
    * Returns a collection view of the values contained in this map.  The
    * collection is backed by the map, so changes to the map are reflected in
@@ -909,10 +923,22 @@
       return ConcurrentHashMap.this.containsValue(o);
     }
     public void clear() {
       ConcurrentHashMap.this.clear();
     }
+    public Object[] toArray() {
+      Collection c = new ArrayList();
+      for (Iterator i = iterator(); i.hasNext(); )
+          c.add(i.next());
+      return c.toArray();
+    }
+    public Object[] toArray(Object[] a) {
+      Collection c = new ArrayList();
+      for (Iterator i = iterator(); i.hasNext(); )
+          c.add(i.next());
+      return c.toArray(a);
+    }
   }
 
   /**
    * Returns a collection view of the mappings contained in this map.  Each
    * element in the returned collection is a <tt>Map.Entry</tt>.  The
@@ -952,10 +978,22 @@
       return ConcurrentHashMap.this.size();
     }
     public void clear() {
       ConcurrentHashMap.this.clear();
     }
+    public Object[] toArray() {
+      Collection c = new ArrayList();
+      for (Iterator i = iterator(); i.hasNext(); )
+          c.add(i.next());
+      return c.toArray();
+    }
+    public Object[] toArray(Object[] a) {
+      Collection c = new ArrayList();
+      for (Iterator i = iterator(); i.hasNext(); )
+          c.add(i.next());
+      return c.toArray(a);
+    }
   }
 
   /**
    * Returns an enumeration of the keys in this table.
    *
