src/share/classes/java/util/List.java
Print this page
rev 3977 : 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
*** 132,144 ****
* <tt>(o==null ? e==null : o.equals(e))</tt>.
*
* @param o element whose presence in this list is to be tested
* @return <tt>true</tt> if this list contains the specified element
* @throws ClassCastException if the type of the specified element
! * is incompatible with this list (optional)
* @throws NullPointerException if the specified element is null and this
! * list does not permit null elements (optional)
*/
boolean contains(Object o);
/**
* Returns an iterator over the elements in this list in proper sequence.
--- 132,146 ----
* <tt>(o==null ? e==null : o.equals(e))</tt>.
*
* @param o element whose presence in this list is to be tested
* @return <tt>true</tt> if this list contains the specified element
* @throws ClassCastException if the type of the specified element
! * is incompatible with this list
! * (<a href="Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null and this
! * list does not permit null elements
! * (<a href="Collection.html#optional-restrictions">optional</a>)
*/
boolean contains(Object o);
/**
* Returns an iterator over the elements in this list in proper sequence.
*** 243,255 ****
* as a result of the call).
*
* @param o element to be removed from this list, if present
* @return <tt>true</tt> if this list contained the specified element
* @throws ClassCastException if the type of the specified element
! * is incompatible with this list (optional)
* @throws NullPointerException if the specified element is null and this
! * list does not permit null elements (optional)
* @throws UnsupportedOperationException if the <tt>remove</tt> operation
* is not supported by this list
*/
boolean remove(Object o);
--- 245,259 ----
* as a result of the call).
*
* @param o element to be removed from this list, if present
* @return <tt>true</tt> if this list contained the specified element
* @throws ClassCastException if the type of the specified element
! * is incompatible with this list
! * (<a href="Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null and this
! * list does not permit null elements
! * (<a href="Collection.html#optional-restrictions">optional</a>)
* @throws UnsupportedOperationException if the <tt>remove</tt> operation
* is not supported by this list
*/
boolean remove(Object o);
*** 263,276 ****
* @param c collection to be checked for containment in this list
* @return <tt>true</tt> if this list contains all of the elements of the
* specified collection
* @throws ClassCastException if the types of one or more elements
* in the specified collection are incompatible with this
! * list (optional)
* @throws NullPointerException if the specified collection contains one
* or more null elements and this list does not permit null
! * elements (optional), or if the specified collection is null
* @see #contains(Object)
*/
boolean containsAll(Collection<?> c);
/**
--- 267,283 ----
* @param c collection to be checked for containment in this list
* @return <tt>true</tt> if this list contains all of the elements of the
* specified collection
* @throws ClassCastException if the types of one or more elements
* in the specified collection are incompatible with this
! * list
! * (<a href="Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified collection contains one
* or more null elements and this list does not permit null
! * elements
! * (<a href="Collection.html#optional-restrictions">optional</a>),
! * or if the specified collection is null
* @see #contains(Object)
*/
boolean containsAll(Collection<?> c);
/**
*** 332,344 ****
* @param c collection containing elements to be removed from this list
* @return <tt>true</tt> if this list changed as a result of the call
* @throws UnsupportedOperationException if the <tt>removeAll</tt> operation
* is not supported by this list
* @throws ClassCastException if the class of an element of this list
! * is incompatible with the specified collection (optional)
* @throws NullPointerException if this list contains a null element and the
! * specified collection does not permit null elements (optional),
* or if the specified collection is null
* @see #remove(Object)
* @see #contains(Object)
*/
boolean removeAll(Collection<?> c);
--- 339,353 ----
* @param c collection containing elements to be removed from this list
* @return <tt>true</tt> if this list changed as a result of the call
* @throws UnsupportedOperationException if the <tt>removeAll</tt> operation
* is not supported by this list
* @throws ClassCastException if the class of an element of this list
! * is incompatible with the specified collection
! * (<a href="Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if this list contains a null element and the
! * specified collection does not permit null elements
! * (<a href="Collection.html#optional-restrictions">optional</a>),
* or if the specified collection is null
* @see #remove(Object)
* @see #contains(Object)
*/
boolean removeAll(Collection<?> c);
*** 352,364 ****
* @param c collection containing elements to be retained in this list
* @return <tt>true</tt> if this list changed as a result of the call
* @throws UnsupportedOperationException if the <tt>retainAll</tt> operation
* is not supported by this list
* @throws ClassCastException if the class of an element of this list
! * is incompatible with the specified collection (optional)
* @throws NullPointerException if this list contains a null element and the
! * specified collection does not permit null elements (optional),
* or if the specified collection is null
* @see #remove(Object)
* @see #contains(Object)
*/
boolean retainAll(Collection<?> c);
--- 361,375 ----
* @param c collection containing elements to be retained in this list
* @return <tt>true</tt> if this list changed as a result of the call
* @throws UnsupportedOperationException if the <tt>retainAll</tt> operation
* is not supported by this list
* @throws ClassCastException if the class of an element of this list
! * is incompatible with the specified collection
! * (<a href="Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if this list contains a null element and the
! * specified collection does not permit null elements
! * (<a href="Collection.html#optional-restrictions">optional</a>),
* or if the specified collection is null
* @see #remove(Object)
* @see #contains(Object)
*/
boolean retainAll(Collection<?> c);
*** 491,503 ****
*
* @param o element to search for
* @return the index of the first occurrence of the specified element in
* this list, or -1 if this list does not contain the element
* @throws ClassCastException if the type of the specified element
! * is incompatible with this list (optional)
* @throws NullPointerException if the specified element is null and this
! * list does not permit null elements (optional)
*/
int indexOf(Object o);
/**
* Returns the index of the last occurrence of the specified element
--- 502,516 ----
*
* @param o element to search for
* @return the index of the first occurrence of the specified element in
* this list, or -1 if this list does not contain the element
* @throws ClassCastException if the type of the specified element
! * is incompatible with this list
! * (<a href="Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null and this
! * list does not permit null elements
! * (<a href="Collection.html#optional-restrictions">optional</a>)
*/
int indexOf(Object o);
/**
* Returns the index of the last occurrence of the specified element
*** 508,520 ****
*
* @param o element to search for
* @return the index of the last occurrence of the specified element in
* this list, or -1 if this list does not contain the element
* @throws ClassCastException if the type of the specified element
! * is incompatible with this list (optional)
* @throws NullPointerException if the specified element is null and this
! * list does not permit null elements (optional)
*/
int lastIndexOf(Object o);
// List Iterators
--- 521,535 ----
*
* @param o element to search for
* @return the index of the last occurrence of the specified element in
* this list, or -1 if this list does not contain the element
* @throws ClassCastException if the type of the specified element
! * is incompatible with this list
! * (<a href="Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null and this
! * list does not permit null elements
! * (<a href="Collection.html#optional-restrictions">optional</a>)
*/
int lastIndexOf(Object o);
// List Iterators