*
* 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:
+ *
*
* 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
@@ -176,7 +174,7 @@ public interface Deque extends Queue<
boolean offerFirst(E e);
/**
- * Inserts the specified element to the end of this deque unless it would
+ * Inserts the specified element at the end of this deque unless it would
* violate capacity restrictions. When using a capacity-restricted deque,
* this method is generally preferable to method addLast which
* can fail to insert an element only by throwing an exception.
@@ -202,7 +200,7 @@ public interface Deque extends Queue<
void addFirst(E e);
/**
- * Inserts the specified element to the end of this deque unless it would
+ * Inserts the specified element at the end of this deque unless it would
* violate capacity restrictions.
*
* @param e the element to insert
@@ -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
@@ -298,7 +296,8 @@ public interface Deque extends Queue<
*
* @param o element to be removed from this deque, if present
* @return true if the deque contained the specified element
- * @throws NullPointerException if the specified element is null
+ * @throws NullPointerException if the specified element is null and this
+ * deque does not permit null elements
*/
boolean removeFirstOccurrence(Object o);
@@ -311,7 +310,8 @@ public interface Deque extends Queue<
*
* @param o element to be removed from this deque, if present
* @return true if the deque contained the specified element
- * @throws NullPointerException if the specified element is null
+ * @throws NullPointerException if the specified element is null and this
+ * deque does not permit null elements
*/
boolean removeLastOccurrence(Object o);
@@ -321,7 +321,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 to the end of this deque. When using a
+ * the specified element at the end of this deque. When using a
* capacity-restricted deque, this method is generally preferable to the
* {@link #add} method, which can fail to insert an element only by
* throwing an exception.
@@ -367,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()}.
@@ -390,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()}.