mirror of
https://github.com/corda/corda.git
synced 2025-02-28 20:06:25 +00:00
Added method addAll to interface Map
This commit is contained in:
parent
b02b98609e
commit
876b02f641
@ -33,8 +33,8 @@ public class Collections {
|
||||
}
|
||||
|
||||
static class SynchronizedCollection<T> implements Collection<T> {
|
||||
private final Object lock;
|
||||
private final Collection<T> collection;
|
||||
protected final Object lock;
|
||||
protected final Collection<T> collection;
|
||||
|
||||
public SynchronizedCollection(Object lock, Collection<T> collection) {
|
||||
this.lock = lock;
|
||||
@ -73,6 +73,11 @@ public class Collections {
|
||||
public SynchronizedSet(Object lock, Set<T> set) {
|
||||
super(lock, set);
|
||||
}
|
||||
|
||||
public void addAll(Collection<T> c) {
|
||||
synchronized (lock) { ((Set<T>)collection).addAll(c); }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class SynchronizedIterator<T> implements Iterator<T> {
|
||||
|
@ -286,6 +286,10 @@ public class HashMap<K, V> implements Map<K, V> {
|
||||
return HashMap.this.size();
|
||||
}
|
||||
|
||||
public void addAll(Collection<Entry<K, V>> c) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean contains(Entry<K, V> e) {
|
||||
return containsKey(e.getKey());
|
||||
}
|
||||
@ -316,6 +320,10 @@ public class HashMap<K, V> implements Map<K, V> {
|
||||
return containsKey(key);
|
||||
}
|
||||
|
||||
public void addAll(Collection<K> c) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean add(K key) {
|
||||
return putCell(key, null) != null;
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
package java.util;
|
||||
|
||||
public interface Set<T> extends Collection<T> { }
|
||||
public interface Set<T> extends Collection<T> {
|
||||
public void addAll(Collection<T> c);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user