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

@ -10,7 +10,7 @@
package java.util;
public class HashSet<T> implements Set<T> {
public class HashSet<T> extends AbstractSet<T> implements Set<T> {
private static final Object Value = new Object();
private final HashMap<T, Object> map;
@ -54,10 +54,6 @@ public class HashSet<T> implements Set<T> {
return map.remove(element) != Value;
}
public <T> T[] toArray(T[] array) {
return Collections.toArray(this, array);
}
public void clear() {
map.clear();
}