208 |
|
|
209 |
|
// Deque methods |
210 |
|
|
211 |
< |
public boolean offerFirst(E o) { |
212 |
< |
if (o == null) throw new NullPointerException(); |
211 |
> |
public boolean offerFirst(E e) { |
212 |
> |
if (e == null) throw new NullPointerException(); |
213 |
|
lock.lock(); |
214 |
|
try { |
215 |
< |
return linkFirst(o); |
215 |
> |
return linkFirst(e); |
216 |
|
} finally { |
217 |
|
lock.unlock(); |
218 |
|
} |
219 |
|
} |
220 |
|
|
221 |
< |
public boolean offerLast(E o) { |
222 |
< |
if (o == null) throw new NullPointerException(); |
221 |
> |
public boolean offerLast(E e) { |
222 |
> |
if (e == null) throw new NullPointerException(); |
223 |
|
lock.lock(); |
224 |
|
try { |
225 |
< |
return linkLast(o); |
225 |
> |
return linkLast(e); |
226 |
|
} finally { |
227 |
|
lock.unlock(); |
228 |
|
} |
300 |
|
|
301 |
|
// BlockingDeque methods |
302 |
|
|
303 |
< |
public void putFirst(E o) throws InterruptedException { |
304 |
< |
if (o == null) throw new NullPointerException(); |
303 |
> |
public void putFirst(E e) throws InterruptedException { |
304 |
> |
if (e == null) throw new NullPointerException(); |
305 |
|
lock.lock(); |
306 |
|
try { |
307 |
< |
while (!linkFirst(o)) |
307 |
> |
while (!linkFirst(e)) |
308 |
|
notFull.await(); |
309 |
|
} finally { |
310 |
|
lock.unlock(); |
311 |
|
} |
312 |
|
} |
313 |
|
|
314 |
< |
public void putLast(E o) throws InterruptedException { |
315 |
< |
if (o == null) throw new NullPointerException(); |
314 |
> |
public void putLast(E e) throws InterruptedException { |
315 |
> |
if (e == null) throw new NullPointerException(); |
316 |
|
lock.lock(); |
317 |
|
try { |
318 |
< |
while (!linkLast(o)) |
318 |
> |
while (!linkLast(e)) |
319 |
|
notFull.await(); |
320 |
|
} finally { |
321 |
|
lock.unlock(); |
346 |
|
} |
347 |
|
} |
348 |
|
|
349 |
< |
public boolean offerFirst(E o, long timeout, TimeUnit unit) |
349 |
> |
public boolean offerFirst(E e, long timeout, TimeUnit unit) |
350 |
|
throws InterruptedException { |
351 |
< |
if (o == null) throw new NullPointerException(); |
351 |
> |
if (e == null) throw new NullPointerException(); |
352 |
|
lock.lockInterruptibly(); |
353 |
|
try { |
354 |
|
long nanos = unit.toNanos(timeout); |
355 |
|
for (;;) { |
356 |
< |
if (linkFirst(o)) |
356 |
> |
if (linkFirst(e)) |
357 |
|
return true; |
358 |
|
if (nanos <= 0) |
359 |
|
return false; |
364 |
|
} |
365 |
|
} |
366 |
|
|
367 |
< |
public boolean offerLast(E o, long timeout, TimeUnit unit) |
367 |
> |
public boolean offerLast(E e, long timeout, TimeUnit unit) |
368 |
|
throws InterruptedException { |
369 |
< |
if (o == null) throw new NullPointerException(); |
369 |
> |
if (e == null) throw new NullPointerException(); |
370 |
|
lock.lockInterruptibly(); |
371 |
|
try { |
372 |
|
long nanos = unit.toNanos(timeout); |
373 |
|
for (;;) { |
374 |
< |
if (linkLast(o)) |
374 |
> |
if (linkLast(e)) |
375 |
|
return true; |
376 |
|
if (nanos <= 0) |
377 |
|
return false; |