39 |
|
* <a href="{@docRoot}/../technotes/guides/collections/index.html"> |
40 |
|
* Java Collections Framework</a>. |
41 |
|
* |
42 |
< |
* @since 1.5 |
42 |
> |
* @since 1.7 |
43 |
|
* @author Doug Lea |
44 |
|
* @param <E> the type of elements held in this collection |
45 |
|
* |
584 |
|
} |
585 |
|
} |
586 |
|
} |
587 |
+ |
|
588 |
+ |
public boolean isEmpty() { |
589 |
+ |
for (;;) { |
590 |
+ |
QNode h = traversalHead(); |
591 |
+ |
QNode p = h.next; |
592 |
+ |
if (p == null) |
593 |
+ |
return true; |
594 |
+ |
Object x = p.get(); |
595 |
+ |
if (p != x) { |
596 |
+ |
if (!p.isData) |
597 |
+ |
return true; |
598 |
+ |
if (x != null) |
599 |
+ |
return false; |
600 |
+ |
} |
601 |
+ |
} |
602 |
+ |
} |
603 |
|
|
604 |
|
public boolean hasWaitingConsumer() { |
605 |
|
for (;;) { |