mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
implement a few more classpath methods, including Collection.addAll and Collection.toArray
This commit is contained in:
@ -40,18 +40,24 @@ public class HashSet<T> implements Set<T> {
|
||||
return map.containsKey(element);
|
||||
}
|
||||
|
||||
public void addAll(Collection<T> c) {
|
||||
for (T t: c) add(t);
|
||||
}
|
||||
|
||||
public boolean add(T element) {
|
||||
return map.put(element, Value) != Value;
|
||||
}
|
||||
|
||||
public boolean addAll(Collection<? extends T> collection) {
|
||||
boolean change = false;
|
||||
for (T t: collection) if (add(t)) change = true;
|
||||
return change;
|
||||
}
|
||||
|
||||
public boolean remove(T element) {
|
||||
return map.remove(element) != Value;
|
||||
}
|
||||
|
||||
public <T> T[] toArray(T[] array) {
|
||||
return Collections.toArray(this, array);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
map.clear();
|
||||
}
|
||||
|
Reference in New Issue
Block a user