extends Queue<
/**
* Inserts the specified element at the end of this deque if it is
- * possible to do so immediately without violating capacity restrictions.
- * When using a capacity-restricted deque, it is generally preferable to
- * use method {@link #offerLast}.
+ * possible to do so immediately without violating capacity restrictions,
+ * throwing an {@code IllegalStateException} if no space is currently
+ * available. When using a capacity-restricted deque, it is generally
+ * preferable to use method {@link #offerLast}.
*
* This method is equivalent to {@link #add}.
*
@@ -313,17 +315,18 @@ public interface Deque extends Queue<
* Removes the first occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
* More formally, removes the first element {@code e} such that
- * (o==null ? e==null : o.equals(e))
- * (if such an element exists).
+ * {@code Objects.equals(o, e)} (if such an element exists).
* Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
* @param o element to be removed from this deque, if present
* @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the class of the specified element
- * is incompatible with this deque (optional)
+ * is incompatible with this deque
+ * (optional)
* @throws NullPointerException if the specified element is null and this
- * deque does not permit null elements (optional)
+ * deque does not permit null elements
+ * (optional)
*/
boolean removeFirstOccurrence(Object o);
@@ -331,17 +334,18 @@ public interface Deque extends Queue<
* Removes the last occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
* More formally, removes the last element {@code e} such that
- * (o==null ? e==null : o.equals(e))
- * (if such an element exists).
+ * {@code Objects.equals(o, e)} (if such an element exists).
* Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
* @param o element to be removed from this deque, if present
* @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the class of the specified element
- * is incompatible with this deque (optional)
+ * is incompatible with this deque
+ * (optional)
* @throws NullPointerException if the specified element is null and this
- * deque does not permit null elements (optional)
+ * deque does not permit null elements
+ * (optional)
*/
boolean removeLastOccurrence(Object o);
@@ -450,8 +454,7 @@ public interface Deque extends Queue<
/**
* Pushes an element onto the stack represented by this deque (in other
* words, at the head of this deque) if it is possible to do so
- * immediately without violating capacity restrictions, returning
- * {@code true} upon success and throwing an
+ * immediately without violating capacity restrictions, throwing an
* {@code IllegalStateException} if no space is currently available.
*
* This method is equivalent to {@link #addFirst}.
@@ -487,34 +490,36 @@ public interface Deque extends Queue<
* Removes the first occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
* More formally, removes the first element {@code e} such that
- * (o==null ? e==null : o.equals(e))
- * (if such an element exists).
+ * {@code Objects.equals(o, e)} (if such an element exists).
* Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
- * This method is equivalent to {@link #removeFirstOccurrence}.
+ *
This method is equivalent to {@link #removeFirstOccurrence(Object)}.
*
* @param o element to be removed from this deque, if present
* @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the class of the specified element
- * is incompatible with this deque (optional)
+ * is incompatible with this deque
+ * (optional)
* @throws NullPointerException if the specified element is null and this
- * deque does not permit null elements (optional)
+ * deque does not permit null elements
+ * (optional)
*/
boolean remove(Object o);
/**
* Returns {@code true} if this deque contains the specified element.
* More formally, returns {@code true} if and only if this deque contains
- * at least one element {@code e} such that
- * (o==null ? e==null : o.equals(e)).
+ * at least one element {@code e} such that {@code Objects.equals(o, e)}.
*
* @param o element whose presence in this deque is to be tested
* @return {@code true} if this deque contains the specified element
- * @throws ClassCastException if the type of the specified element
- * is incompatible with this deque (optional)
+ * @throws ClassCastException if the class of the specified element
+ * is incompatible with this deque
+ * (optional)
* @throws NullPointerException if the specified element is null and this
- * deque does not permit null elements (optional)
+ * deque does not permit null elements
+ * (optional)
*/
boolean contains(Object o);
@@ -523,7 +528,7 @@ public interface Deque extends Queue<
*
* @return the number of elements in this deque
*/
- public int size();
+ int size();
/**
* Returns an iterator over the elements in this deque in proper sequence.