1 |
|
/* |
2 |
< |
* @(#)LinkedList.java 1.53 03/06/22 |
2 |
> |
* %W% %E% |
3 |
|
* |
4 |
|
* Copyright 2003 Sun Microsystems, Inc. All rights reserved. |
5 |
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. |
62 |
|
* Java Collections Framework</a>. |
63 |
|
* |
64 |
|
* @author Josh Bloch |
65 |
< |
* @version 1.53, 06/22/03 |
65 |
> |
* @version %I%, %G% |
66 |
|
* @see List |
67 |
|
* @see ArrayList |
68 |
|
* @see Vector |
442 |
|
// Queue operations. |
443 |
|
|
444 |
|
/** |
445 |
< |
* Retrieves, but does not remove, the head (first element) of this list.. |
445 |
> |
* Retrieves, but does not remove, the head (first element) of this list. |
446 |
|
* @return the head of this queue, or <tt>null</tt> if this queue is empty. |
447 |
+ |
* @since 1.5 |
448 |
|
*/ |
449 |
|
public E peek() { |
450 |
|
if (size==0) |
453 |
|
} |
454 |
|
|
455 |
|
/** |
456 |
< |
* Retrieves, but does not remove, the head (first element) of this list.. |
456 |
> |
* Retrieves, but does not remove, the head (first element) of this list. |
457 |
|
* @return the head of this queue. |
458 |
|
* @throws NoSuchElementException if this queue is empty. |
459 |
+ |
* @since 1.5 |
460 |
|
*/ |
461 |
|
public E element() { |
462 |
|
return getFirst(); |
463 |
|
} |
464 |
|
|
465 |
|
/** |
466 |
< |
* Retrieves and removes the head (first element) of this list.. |
466 |
> |
* Retrieves and removes the head (first element) of this list. |
467 |
|
* @return the head of this queue, or <tt>null</tt> if this queue is empty. |
468 |
+ |
* @since 1.5 |
469 |
|
*/ |
470 |
|
public E poll() { |
471 |
|
if (size==0) |
474 |
|
} |
475 |
|
|
476 |
|
/** |
477 |
< |
* Retrieves and removes the head (first element) of this list.. |
477 |
> |
* Retrieves and removes the head (first element) of this list. |
478 |
|
* @return the head of this queue. |
479 |
|
* @throws NoSuchElementException if this queue is empty. |
480 |
+ |
* @since 1.5 |
481 |
|
*/ |
482 |
|
public E remove() { |
483 |
|
return removeFirst(); |
489 |
|
* @param x the element to add. |
490 |
|
* @return <tt>true</tt> (as per the general contract of |
491 |
|
* <tt>Queue.offer</tt>) |
492 |
+ |
* @since 1.5 |
493 |
|
*/ |
494 |
|
public boolean offer(E x) { |
495 |
|
return add(x); |