43 |
|
* </tr> |
44 |
|
* </table> |
45 |
|
* |
46 |
< |
* <p>Like any {@link BlockingQueue}, a <tt>BlockingDeque</tt> is |
46 |
> |
* <p>Like any {@link BlockingQueue}, a {@code BlockingDeque} is |
47 |
|
* thread safe and may (or may not) be capacity-constrained. A |
48 |
< |
* <tt>BlockingDeque</tt> implementation may be used directly as a |
49 |
< |
* FIFO <tt>BlockingQueue</tt>. The blocking methods inherited from |
50 |
< |
* the <tt>BlockingQueue</tt> interface are precisely equivalent to |
51 |
< |
* <tt>BlockingDeque</tt> methods as indicated in the following table:<p> |
48 |
> |
* {@code BlockingDeque} implementation may be used directly as a |
49 |
> |
* FIFO {@code BlockingQueue}. The blocking methods inherited from |
50 |
> |
* the {@code BlockingQueue} interface are precisely equivalent to |
51 |
> |
* {@code BlockingDeque} methods as indicated in the following table:<p> |
52 |
|
* |
53 |
|
* <table BORDER CELLPADDING=3 CELLSPACING=1> |
54 |
|
* <tr> |
55 |
< |
* <td ALIGN=CENTER> <b><tt>BlockingQueue</tt> Method</b></td> |
56 |
< |
* <td ALIGN=CENTER> <b>Equivalent <tt>BlockingDeque</tt> Method</b></td> |
55 |
> |
* <td ALIGN=CENTER> <b>{@code BlockingQueue} Method</b></td> |
56 |
> |
* <td ALIGN=CENTER> <b>Equivalent {@code BlockingDeque} Method</b></td> |
57 |
|
* </tr> |
58 |
|
* <tr> |
59 |
|
* <tr> |
90 |
|
* waiting if necessary for space to become available. |
91 |
|
* @param o the element to add |
92 |
|
* @throws InterruptedException if interrupted while waiting |
93 |
< |
* @throws NullPointerException if the specified element is <tt>null</tt> |
93 |
> |
* @throws NullPointerException if the specified element is {@code null} |
94 |
|
*/ |
95 |
|
void putFirst(E o) throws InterruptedException; |
96 |
|
|
99 |
|
* waiting if necessary for space to become available. |
100 |
|
* @param o the element to add |
101 |
|
* @throws InterruptedException if interrupted while waiting |
102 |
< |
* @throws NullPointerException if the specified element is <tt>null</tt> |
102 |
> |
* @throws NullPointerException if the specified element is {@code null} |
103 |
|
*/ |
104 |
|
void putLast(E o) throws InterruptedException; |
105 |
|
|
125 |
|
* become available. |
126 |
|
* @param o the element to add |
127 |
|
* @param timeout how long to wait before giving up, in units of |
128 |
< |
* <tt>unit</tt> |
129 |
< |
* @param unit a <tt>TimeUnit</tt> determining how to interpret the |
130 |
< |
* <tt>timeout</tt> parameter |
131 |
< |
* @return <tt>true</tt> if successful, or <tt>false</tt> if |
128 |
> |
* {@code unit} |
129 |
> |
* @param unit a {@code TimeUnit} determining how to interpret the |
130 |
> |
* {@code timeout} parameter |
131 |
> |
* @return {@code true} if successful, or {@code false} if |
132 |
|
* the specified waiting time elapses before space is available |
133 |
|
* @throws InterruptedException if interrupted while waiting |
134 |
< |
* @throws NullPointerException if the specified element is <tt>null</tt> |
134 |
> |
* @throws NullPointerException if the specified element is {@code null} |
135 |
|
*/ |
136 |
|
boolean offerFirst(E o, long timeout, TimeUnit unit) |
137 |
|
throws InterruptedException; |
142 |
|
* become available. |
143 |
|
* @param o the element to add |
144 |
|
* @param timeout how long to wait before giving up, in units of |
145 |
< |
* <tt>unit</tt> |
146 |
< |
* @param unit a <tt>TimeUnit</tt> determining how to interpret the |
147 |
< |
* <tt>timeout</tt> parameter |
148 |
< |
* @return <tt>true</tt> if successful, or <tt>false</tt> if |
145 |
> |
* {@code unit} |
146 |
> |
* @param unit a {@code TimeUnit} determining how to interpret the |
147 |
> |
* {@code timeout} parameter |
148 |
> |
* @return {@code true} if successful, or {@code false} if |
149 |
|
* the specified waiting time elapses before space is available |
150 |
|
* @throws InterruptedException if interrupted while waiting |
151 |
< |
* @throws NullPointerException if the specified element is <tt>null</tt> |
151 |
> |
* @throws NullPointerException if the specified element is {@code null} |
152 |
|
*/ |
153 |
|
boolean offerLast(E o, long timeout, TimeUnit unit) |
154 |
|
throws InterruptedException; |
159 |
|
* if necessary up to the specified wait time if no elements are |
160 |
|
* present on this deque. |
161 |
|
* @param timeout how long to wait before giving up, in units of |
162 |
< |
* <tt>unit</tt> |
163 |
< |
* @param unit a <tt>TimeUnit</tt> determining how to interpret the |
164 |
< |
* <tt>timeout</tt> parameter |
165 |
< |
* @return the head of this deque, or <tt>null</tt> if the |
162 |
> |
* {@code unit} |
163 |
> |
* @param unit a {@code TimeUnit} determining how to interpret the |
164 |
> |
* {@code timeout} parameter |
165 |
> |
* @return the head of this deque, or {@code null} if the |
166 |
|
* specified waiting time elapses before an element is present |
167 |
|
* @throws InterruptedException if interrupted while waiting |
168 |
|
*/ |
174 |
|
* if necessary up to the specified wait time if no elements are |
175 |
|
* present on this deque. |
176 |
|
* @param timeout how long to wait before giving up, in units of |
177 |
< |
* <tt>unit</tt> |
178 |
< |
* @param unit a <tt>TimeUnit</tt> determining how to interpret the |
179 |
< |
* <tt>timeout</tt> parameter |
180 |
< |
* @return the head of this deque, or <tt>null</tt> if the |
177 |
> |
* {@code unit} |
178 |
> |
* @param unit a {@code TimeUnit} determining how to interpret the |
179 |
> |
* {@code timeout} parameter |
180 |
> |
* @return the head of this deque, or {@code null} if the |
181 |
|
* specified waiting time elapses before an element is present |
182 |
|
* @throws InterruptedException if interrupted while waiting |
183 |
|
*/ |
187 |
|
/** |
188 |
|
* Adds the specified element as the last element of this deque, |
189 |
|
* waiting if necessary for space to become available. This |
190 |
< |
* method is equivalent to putLast |
190 |
> |
* method is equivalent to putLast. |
191 |
|
* @param o the element to add |
192 |
|
* @throws InterruptedException if interrupted while waiting |
193 |
< |
* @throws NullPointerException if the specified element is <tt>null</tt> |
193 |
> |
* @throws NullPointerException if the specified element is {@code null} |
194 |
|
*/ |
195 |
|
void put(E o) throws InterruptedException; |
196 |
|
|
198 |
|
* Inserts the specified element as the lest element of this |
199 |
|
* deque, if possible. When using deques that may impose |
200 |
|
* insertion restrictions (for example capacity bounds), method |
201 |
< |
* <tt>offer</tt> is generally preferable to method {@link |
201 |
> |
* {@code offer} is generally preferable to method {@link |
202 |
|
* Collection#add}, which can fail to insert an element only by |
203 |
|
* throwing an exception. This method is equivalent to |
204 |
|
* offerLast. |
205 |
|
* |
206 |
|
* @param o the element to add |
207 |
< |
* @return <tt>true</tt> if it was possible to add the element to |
208 |
< |
* this deque, else <tt>false</tt> |
209 |
< |
* @throws NullPointerException if the specified element is <tt>null</tt> |
207 |
> |
* @return {@code true} if it was possible to add the element to |
208 |
> |
* this deque, else {@code false} |
209 |
> |
* @throws NullPointerException if the specified element is {@code null} |
210 |
|
*/ |
211 |
|
boolean offer(E o, long timeout, TimeUnit unit) |
212 |
|
throws InterruptedException; |
226 |
|
* present on this deque. This method is equivalent to |
227 |
|
* pollFirst. |
228 |
|
* @param timeout how long to wait before giving up, in units of |
229 |
< |
* <tt>unit</tt> |
230 |
< |
* @param unit a <tt>TimeUnit</tt> determining how to interpret the |
231 |
< |
* <tt>timeout</tt> parameter |
232 |
< |
* @return the head of this deque, or <tt>null</tt> if the |
229 |
> |
* {@code unit} |
230 |
> |
* @param unit a {@code TimeUnit} determining how to interpret the |
231 |
> |
* {@code timeout} parameter |
232 |
> |
* @return the head of this deque, or {@code null} if the |
233 |
|
* specified waiting time elapses before an element is present |
234 |
|
* @throws InterruptedException if interrupted while waiting |
235 |
|
*/ |