Репозитории ALT
5.1: | 1.3.4-alt1_9jpp5 |
4.1: | 1.3.4-alt1_7jpp1.7 |
4.0: | 1.3.4-alt1_7jpp1.7 |
Группа :: Разработка/Java
Пакет: concurrent
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: concurrent-ConcurrentHashMap.patch
Скачать
Скачать
Index: src/EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap.java
===================================================================
--- src/EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap.java (revision 4)
+++ 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);
+ }
}
/**