remove redundant synchronization from Collections.SynchronizedCollection

This commit is contained in:
Joel Dice 2008-01-28 08:10:23 -07:00
parent 941ca81e79
commit 707359d555

View File

@ -41,7 +41,7 @@ public class Collections {
this.collection = collection; this.collection = collection;
} }
public synchronized int size() { public int size() {
synchronized (lock) { return collection.size(); } synchronized (lock) { return collection.size(); }
} }
@ -49,19 +49,19 @@ public class Collections {
return size() == 0; return size() == 0;
} }
public synchronized boolean contains(T e) { public boolean contains(T e) {
synchronized (lock) { return collection.contains(e); } synchronized (lock) { return collection.contains(e); }
} }
public synchronized boolean add(T e) { public boolean add(T e) {
synchronized (lock) { return collection.add(e); } synchronized (lock) { return collection.add(e); }
} }
public synchronized boolean remove(T e) { public boolean remove(T e) {
synchronized (lock) { return collection.remove(e); } synchronized (lock) { return collection.remove(e); }
} }
public synchronized void clear() { public void clear() {
synchronized (lock) { collection.clear(); } synchronized (lock) { collection.clear(); }
} }