add java.util.Collection.toArray()

This commit is contained in:
Joel Dice
2009-08-04 17:36:25 -06:00
parent 7911989055
commit 0a7f94abfe
10 changed files with 40 additions and 19 deletions

View File

@ -334,6 +334,10 @@ public class HashMap<K, V> implements Map<K, V> {
return removeCell(e.getKey()) != null;
}
public Object[] toArray() {
return toArray(new Object[size()]);
}
public <T> T[] toArray(T[] array) {
return Collections.toArray(this, array);
}
@ -374,6 +378,10 @@ public class HashMap<K, V> implements Map<K, V> {
return removeCell(key) != null;
}
public Object[] toArray() {
return toArray(new Object[size()]);
}
public <T> T[] toArray(T[] array) {
return Collections.toArray(this, array);
}
@ -412,6 +420,10 @@ public class HashMap<K, V> implements Map<K, V> {
throw new UnsupportedOperationException();
}
public Object[] toArray() {
return toArray(new Object[size()]);
}
public <T> T[] toArray(T[] array) {
return Collections.toArray(this, array);
}