Index: /root/jboss/4.0.5GA/oswegolocalrepos/src/EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap.java =================================================================== --- /root/jboss/4.0.5GA/oswegolocalrepos/src/EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap.java (revision 4) +++ /root/jboss/4.0.5GA/oswegolocalrepos/src/EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap.java (working copy) @@ -21,6 +21,7 @@ 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; @@ -31,6 +32,7 @@ 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; @@ -879,6 +881,32 @@ public void clear() { ConcurrentHashMap.this.clear(); } + public Object[] toArray() { + Collection c = new ArrayList(); + Object o=null; + for (Iterator i = iterator(); i.hasNext(); ) + { + o = i.next(); + if(o!=null) + { + c.add(o); + } + } + return c.toArray(); + } + public Object[] toArray(Object[] a) { + Collection c = new ArrayList(); + Object o=null; + for (Iterator i = iterator(); i.hasNext(); ) + { + o = i.next(); + if(o!=null) + { + c.add(o); + } + } + return c.toArray(a); + } } /** @@ -911,6 +939,32 @@ public void clear() { ConcurrentHashMap.this.clear(); } + public Object[] toArray() { + Collection c = new ArrayList(); + Object o=null; + for (Iterator i = iterator(); i.hasNext(); ) + { + o = i.next(); + if(o!=null) + { + c.add(o); + } + } + return c.toArray(); + } + public Object[] toArray(Object[] a) { + Collection c = new ArrayList(); + Object o=null; + for (Iterator i = iterator(); i.hasNext(); ) + { + o = i.next(); + if(o!=null) + { + c.add(o); + } + } + return c.toArray(a); + } } /** @@ -954,6 +1008,32 @@ public void clear() { ConcurrentHashMap.this.clear(); } + public Object[] toArray() { + Collection c = new ArrayList(); + Object o=null; + for (Iterator i = iterator(); i.hasNext(); ) + { + o = i.next(); + if(o!=null) + { + c.add(o); + } + } + return c.toArray(); + } + public Object[] toArray(Object[] a) { + Collection c = new ArrayList(); + Object o=null; + for (Iterator i = iterator(); i.hasNext(); ) + { + o = i.next(); + if(o!=null) + { + c.add(o); + } + } + return c.toArray(a); + } } /**