*
* 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,7 +230,7 @@ public interface Deque extends Queue<
E pollLast();
/**
- * Removes and returns the first element of this deque. This method
+ * Retrieves and removes the first element of this deque. This method
* differs from the pollFirst method only in that it throws an
* exception if this deque is empty.
*
@@ -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.