--- jsr166/src/jsr166x/Deque.java 2004/12/05 21:15:31 1.3 +++ jsr166/src/jsr166x/Deque.java 2010/09/07 06:05:17 1.9 @@ -8,25 +8,26 @@ package jsr166x; // XXX This belongs import java.util.*; // XXX This import goes away XXX /** - * A linear collection that supports element insertion and removal - * at both ends. The name deque is short for "double ended - * queue" and is usually pronounced "deck". Most Deque + * A linear collection that supports element insertion and removal at + * both ends. The name deque is short for "double ended queue" + * and is usually pronounced "deck". Most Deque * implementations place no fixed limits on the number of elements * they may contain, but this interface supports capacity-restricted * deques as well as those with no fixed size limit. * - *

This interface defines methods to access the elements at both ends of - * the deque. Methods are provided to insert, remove, and examine the - * element. Each of these methods exists in two forms: one throws an - * exception if the operation fails, the other returns a special value (either - * null or false, depending on the operation). The latter - * form of the insert operation is designed specifically for use with - * capacity-restricted Deque implementations; in most implementations, - * insert operations cannot fail. - * - *

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

- * + *

This interface defines methods to access the elements at both + * ends of the deque. Methods are provided to insert, remove, and + * examine the element. Each of these methods exists in two forms: + * one throws an exception if the operation fails, the other returns a + * special value (either null or false, depending on + * the operation). The latter form of the insert operation is + * designed specifically for use with capacity-restricted + * Deque implementations; in most implementations, insert + * operations cannot fail. + * + *

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

+ * * * * @@ -56,9 +57,9 @@ import java.util.*; // XXX This impor * * * - * + * * - * + * * * *
Examine{@link #firstElement firstElement()}{@link #getFirst getFirst()}{@link #peekFirst peekFirst()}{@link #lastElement lastElement()}{@link #getLast getLast()}{@link #peekLast peekLast()}
@@ -97,7 +98,7 @@ import java.util.*; // XXX This impor * * * {@link java.util.Queue#element element()} - * {@link #firstElement firstElement()} + * {@link #getFirst getFirst()} * * * @@ -126,24 +127,25 @@ import java.util.*; // XXX This impor * {@link #peekFirst peekFirst()} * * - *

Note that the {@link #peek peek} method works equally well when a deque - * is used as a queue or a stack; in either case, elements are drawn from the - * beginning of the deque. - * - *

This inteface provides two methods to to remove interior elements, - * {@link #removeFirstOccurrence removeFirstOccurrence} and {@link - * #removeLastOccurrence removeLastOccurrence}. Unlike the {@link List} - * interface, this interface does not provide support for indexed access to - * elements. - * - *

While Deque implementations are not strictly required to - * prohibit the insertion of null elements, they are strongly encouraged to do - * so. Users of any Deque implementations that do allow null - * elements are strongly encouraged not to take advantage of the - * ability to insert nulls. This is so because null is used as a - * special return value by various methods to indicated that the deque is - * empty. - * + * + *

Note that the {@link #peek peek} method works equally well when + * a deque is used as a queue or a stack; in either case, elements are + * drawn from the beginning of the deque. + * + *

This interface provides two methods to remove interior + * elements, {@link #removeFirstOccurrence removeFirstOccurrence} and + * {@link #removeLastOccurrence removeLastOccurrence}. Unlike the + * {@link List} interface, this interface does not provide support for + * indexed access to elements. + * + *

While Deque implementations are not strictly required + * to prohibit the insertion of null elements, they are strongly + * encouraged to do so. Users of any Deque implementations + * that do allow null elements are strongly encouraged not to + * take advantage of the ability to insert nulls. This is so because + * null is used as a special return value by various methods + * to indicated that the deque is empty. + * *

Deque implementations generally do not define * element-based versions of the equals and hashCode * methods, but instead inherit the identity-based versions from class @@ -275,7 +277,7 @@ public interface Deque extends Queue< * @return the first element of this deque * @throws NoSuchElementException if this deque is empty */ - E firstElement(); + E getFirst(); /** * Retrieves, but does not remove, the last element of this @@ -285,7 +287,7 @@ public interface Deque extends Queue< * @return the last element of this deque * @throws NoSuchElementException if this deque is empty */ - E lastElement(); + E getLast(); /** * Removes the first occurrence of the specified element in this @@ -337,7 +339,7 @@ public interface Deque extends Queue< /** * Inserts the specified element into the queue represented by this * deque unless it would violate capacity restrictions. In other words, - * inserts the specified element as the last element of this deque. + * inserts the specified element as the last element of this deque. * *

This method is equivalent to {@link #addLast}. * @@ -391,7 +393,7 @@ public interface Deque extends Queue< * this deque. This method differs from the peek method only in * that it throws an exception if this deque is empty. * - *

This method is equivalent to {@link #firstElement()} + *

This method is equivalent to {@link #getFirst()} * * @return the head of the queue represented by this deque * @throws NoSuchElementException if this deque is empty @@ -417,7 +419,7 @@ public interface Deque extends Queue< /** * Pops an element from the stack represented by this deque. In other - * words, removes and returns the the first element of this deque. + * words, removes and returns the first element of this deque. * *

This method is equivalent to {@link #removeFirst()}. * @@ -433,7 +435,7 @@ public interface Deque extends Queue< /** * Returns an iterator over the elements in this deque. The elements * will be ordered from first (head) to last (tail). - * + * * @return an Iterator over the elements in this deque */ Iterator iterator();