@@ -148,7 +145,7 @@ package java.util;
* that do allow null elements are strongly encouraged not to
* take advantage of the ability to insert nulls. This is so because
* {@code null} is used as a special return value by various methods
- * to indicated that the deque is empty.
+ * to indicate that the deque is empty.
*
* {@code Deque} implementations generally do not define
* element-based versions of the {@code equals} and {@code hashCode}
@@ -162,7 +159,7 @@ package java.util;
* @author Doug Lea
* @author Josh Bloch
* @since 1.6
- * @param the type of elements held in this collection
+ * @param the type of elements held in this deque
*/
public interface Deque extends Queue {
/**
@@ -318,8 +315,7 @@ 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).
*
@@ -327,9 +323,10 @@ public interface Deque extends Queue<
* @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)
- * @throws NullPointerException if the specified element is null
- * (optional)
+ * (optional)
+ * @throws NullPointerException if the specified element is null and this
+ * deque does not permit null elements
+ * (optional)
*/
boolean removeFirstOccurrence(Object o);
@@ -337,8 +334,7 @@ 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).
*
@@ -346,9 +342,10 @@ public interface Deque extends Queue<
* @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)
- * @throws NullPointerException if the specified element is null
- * (optional)
+ * (optional)
+ * @throws NullPointerException if the specified element is null and this
+ * deque does not permit null elements
+ * (optional)
*/
boolean removeLastOccurrence(Object o);
@@ -493,8 +490,7 @@ 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).
*
@@ -504,25 +500,26 @@ public interface Deque extends Queue<
* @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)
- * @throws NullPointerException if the specified element is null
- * (optional)
+ * (optional)
+ * @throws NullPointerException if the specified element is null and this
+ * 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 class of the specified element
* is incompatible with this deque
- * (optional)
- * @throws NullPointerException if the specified element is null
- * (optional)
+ * (optional)
+ * @throws NullPointerException if the specified element is null and this
+ * deque does not permit null elements
+ * (optional)
*/
boolean contains(Object o);
@@ -531,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.