Streamline LinkedTransferQueue.isEmpty()

This commit is contained in:
Trustin Lee 2010-05-28 02:59:17 +00:00
parent 11705c9915
commit a2ef43cf3d

View File

@ -1241,7 +1241,12 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
*/ */
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
return firstOfMode(true) == null; for (Node p = head; p != null; p = succ(p)) {
if (!p.isMatched()) {
return !p.isData;
}
}
return true;
} }
public boolean hasWaitingConsumer() { public boolean hasWaitingConsumer() {