fix build breakage due to missing isEmpty() methods

This commit is contained in:
Joel Dice 2007-11-07 09:48:09 -07:00
parent 4611c89dbe
commit fef3cddb9e
4 changed files with 24 additions and 1 deletions

View File

@ -45,6 +45,10 @@ public class Collections {
synchronized (lock) { return collection.size(); }
}
public boolean isEmpty() {
return size() == 0;
}
public synchronized boolean contains(T e) {
synchronized (lock) { return collection.contains(e); }
}
@ -77,7 +81,6 @@ public class Collections {
public void addAll(Collection<T> c) {
synchronized (lock) { ((Set<T>)collection).addAll(c); }
}
}
static class SynchronizedIterator<T> implements Iterator<T> {

View File

@ -293,6 +293,10 @@ public class HashMap<K, V> implements Map<K, V> {
return HashMap.this.size();
}
public boolean isEmpty() {
return HashMap.this.isEmpty();
}
public void addAll(Collection<Entry<K, V>> c) {
throw new UnsupportedOperationException();
}
@ -323,6 +327,10 @@ public class HashMap<K, V> implements Map<K, V> {
return HashMap.this.size();
}
public boolean isEmpty() {
return HashMap.this.isEmpty();
}
public boolean contains(K key) {
return containsKey(key);
}
@ -354,6 +362,10 @@ public class HashMap<K, V> implements Map<K, V> {
return HashMap.this.size();
}
public boolean isEmpty() {
return HashMap.this.isEmpty();
}
public boolean contains(V value) {
return containsValue(value);
}

View File

@ -22,6 +22,10 @@ public class HashSet<T> implements Set<T> {
return map.size();
}
public boolean isEmpty() {
return map.isEmpty();
}
public boolean contains(T element) {
return map.containsKey(element);
}

View File

@ -63,6 +63,10 @@ public class TreeSet<T> implements Collection<T> {
return size;
}
public boolean isEmpty() {
return size == 0;
}
public boolean contains(T value) {
return !set.find(new Cell(value, null)).fresh();
}