--- jsr166/src/main/java/util/Deque.java 2005/03/22 16:48:32 1.4 +++ jsr166/src/main/java/util/Deque.java 2005/05/02 04:19:58 1.6 @@ -25,9 +25,9 @@ package java.util; * operations cannot fail. * *

The twelve methods described above are summarized in the - * following table:

+ * following table: * - * + *

* * * @@ -67,64 +67,62 @@ package java.util; * used as a queue, FIFO (First-In-First-Out) behavior results. Elements are * added at the end of the deque and removed from the beginning. The methods * inherited from the Queue interface are precisely equivalent to - * Deque methods as indicated in the following table:

+ * Deque methods as indicated in the following table: * - *

First Element (Head)
+ *

* * * * * - * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * + * *
Queue Method Equivalent Deque Method
{@link java.util.Queue#offer offer(e)}{@link #offerLast offerLast(e)}
{@link java.util.Queue#add add(e)}{@link #addLast addLast(e)}
{@link java.util.Queue#poll poll()}{@link #pollFirst pollFirst()}
{@link java.util.Queue#remove remove()}{@link #removeFirst removeFirst()}
{@link java.util.Queue#peek peek()}{@link #peek peekFirst()}
{@link java.util.Queue#element element()}{@link #getFirst getFirst()}
* *

Deques can also be used as LIFO (Last-In-First-Out) stacks. This * interface should be used in preference to the legacy {@link Stack} class. * When a deque is used as a stack, elements are pushed and popped from the * beginning of the deque. Stack methods are precisely equivalent to - * Deque methods as indicated in the table below:

+ * Deque methods as indicated in the table below: * - * + *

* * * * * - * * * - * - * + * + * * * - * - * + * + * * * - * + * *
Stack Method Equivalent Deque Method
{@link #push push(e)}{@link #addFirst addFirst(e)}
{@link #pop pop()}{@link #removeFirst removeFirst()}
{@link #peek peek()}{@link #peekFirst peekFirst()}
* *

Note that the {@link #peek peek} method works equally well when @@ -232,8 +230,8 @@ public interface Deque extends Queue< E pollLast(); /** - * Removes and returns the first element of this deque. This method - * differs from the pollFirst method only in that it throws an + * Retrieves and removes the first element of this deque. This method + * differs from the {@link #pollFirst} method only in that it throws an * exception if this deque is empty. * * @return the first element of this deque @@ -243,7 +241,7 @@ public interface Deque extends Queue< /** * Retrieves and removes the last element of this deque. This method - * differs from the pollLast method only in that it throws an + * differs from the {@link #pollLast} method only in that it throws an * exception if this deque is empty. * * @return the last element of this deque @@ -271,7 +269,7 @@ public interface Deque extends Queue< /** * Retrieves, but does not remove, the first element of this - * deque. This method differs from the peekFirst method only + * deque. This method differs from the {@link #peekFirst} method only * in that it throws an exception if this deque is empty. * * @return the first element of this deque @@ -281,7 +279,7 @@ public interface Deque extends Queue< /** * Retrieves, but does not remove, the last element of this - * deque. This method differs from the peekLast method only + * deque. This method differs from the {@link #peekLast} method only * in that it throws an exception if this deque is empty. * * @return the last element of this deque @@ -369,7 +367,7 @@ public interface Deque extends Queue< /** * Retrieves and removes the head of the queue represented by this deque. - * This method differs from the poll method only in that it + * This method differs from the {@link #poll} method only in that it * throws an exception if this deque is empty. * *

This method is equivalent to {@link #removeFirst()}. @@ -392,7 +390,7 @@ public interface Deque extends Queue< /** * Retrieves, but does not remove, the head of the queue represented by - * this deque. This method differs from the peek method only in + * this deque. This method differs from the {@link #peek} method only in * that it throws an exception if this deque is empty. * *

This method is equivalent to {@link #getFirst()}.