15 |
|
* @since 1.5 |
16 |
|
* @author Doug Lea |
17 |
|
*/ |
18 |
< |
|
18 |
> |
|
19 |
|
public abstract class AbstractQueue<E> extends AbstractCollection<E> implements Queue<E> { |
20 |
|
|
21 |
|
public boolean add(E x) { |
25 |
|
throw new IllegalStateException("Queue full"); |
26 |
|
} |
27 |
|
|
28 |
< |
public E remove() { |
28 |
> |
public E remove() throws NoSuchElementException { |
29 |
|
E x = poll(); |
30 |
|
if (x != null) |
31 |
|
return x; |
33 |
|
throw new NoSuchElementException(); |
34 |
|
} |
35 |
|
|
36 |
< |
public E element() { |
36 |
> |
public E element() throws NoSuchElementException { |
37 |
|
E x = peek(); |
38 |
|
if (x != null) |
39 |
|
return x; |
46 |
|
; |
47 |
|
} |
48 |
|
|
49 |
+ |
// XXX Remove this redundant declaration, pending response from Neal Gafter. |
50 |
+ |
public abstract Iterator<E> iterator(); |
51 |
|
} |
52 |
+ |
|
53 |
+ |
|
54 |
+ |
|
55 |
+ |
|
56 |
+ |
|