mirror of
https://github.com/corda/corda.git
synced 2025-06-13 12:48:18 +00:00
Added more to the avian classpath for the collection interface as well as the list interface
Added to collection: public boolean containsAll(Collection<?> c); public boolean removeAll(Collection<?> c); Added to list: public boolean addAll(int startIndex, Collection<? extends T> c); Also where possible for inner classes I made them extend the abstract version instead of just implement the interface. This helps reduce code duplication where possible. These changes were necessary to support protobuf 2.5.0
This commit is contained in:
@ -51,6 +51,21 @@ public abstract class AbstractCollection<T> implements Collection<T> {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
if (c == null) {
|
||||
throw new NullPointerException("Collection is null");
|
||||
}
|
||||
|
||||
Iterator<?> it = c.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (! contains(it.next())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return size() == 0;
|
||||
}
|
||||
@ -60,6 +75,21 @@ public abstract class AbstractCollection<T> implements Collection<T> {
|
||||
+ this.getClass().getName());
|
||||
}
|
||||
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
if (c == null) {
|
||||
throw new NullPointerException("Collection is null");
|
||||
}
|
||||
|
||||
boolean changed = false;
|
||||
|
||||
Iterator<?> it = c.iterator();
|
||||
while (it.hasNext()) {
|
||||
changed = remove(it.next()) || changed;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
public abstract int size();
|
||||
|
||||
public Object[] toArray() {
|
||||
|
Reference in New Issue
Block a user