+2004-08-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/util/Collection.java, java/util/List.java,
+ java/util/Map.java, java/util/Set.java,
+ java/util/SortedMap.java, java/util/SortedSet.java:
+ Added additional exceptions to documentation.
+
2004-08-01 Danny Smith <dannysmith@users.sourceforge.net>
PR libgcj/16814
* support the add operation.
* @throws ClassCastException if o cannot be added to this collection due
* to its type.
+ * @throws NullPointerException if o is null and this collection doesn't
+ * support the addition of null values.
* @throws IllegalArgumentException if o cannot be added to this
* collection for some other reason.
*/
* support the addAll operation.
* @throws ClassCastException if some element of c cannot be added to this
* collection due to its type.
+ * @throws NullPointerException if some element of c is null and this
+ * collection does not support the addition of null values.
+ * @throws NullPointerException if c itself is null.
* @throws IllegalArgumentException if some element of c cannot be added
* to this collection for some other reason.
*/
* @param o the element to look for.
* @return true if this collection contains at least one element e such that
* <code>o == null ? e == null : o.equals(e)</code>.
+ * @throws ClassCastException if the type of o is not a valid type for this
+ * collection.
+ * @throws NullPointerException if o is null and this collection doesn't
+ * support null values.
*/
boolean contains(Object o);
*
* @param c the collection to test for.
* @return true if for every element o in c, contains(o) would return true.
+ * @throws ClassCastException if the type of any element in c is not a valid
+ * type for this collection.
+ * @throws NullPointerException if some element of c is null and this
+ * collection does not support null values.
+ * @throws NullPointerException if c itself is null.
*/
boolean containsAll(Collection c);
* if the collection contained at least one occurrence of o.
* @throws UnsupportedOperationException if this collection does not
* support the remove operation.
+ * @throws ClassCastException if the type of o is not a valid type
+ * for this collection.
+ * @throws NullPointerException if o is null and the collection doesn't
+ * support null values.
*/
boolean remove(Object o);
* @return true if this collection was modified as a result of this call.
* @throws UnsupportedOperationException if this collection does not
* support the removeAll operation.
+ * @throws ClassCastException if the type of any element in c is not a valid
+ * type for this collection.
+ * @throws NullPointerException if some element of c is null and this
+ * collection does not support removing null values.
+ * @throws NullPointerException if c itself is null.
*/
boolean removeAll(Collection c);
* @return true if this collection was modified as a result of this call.
* @throws UnsupportedOperationException if this collection does not
* support the retainAll operation.
+ * @throws ClassCastException if the type of any element in c is not a valid
+ * type for this collection.
+ * @throws NullPointerException if some element of c is null and this
+ * collection does not support retaining null values.
+ * @throws NullPointerException if c itself is null.
*/
boolean retainAll(Collection c);
* type
* @throws IllegalArgumentException if o cannot be added to this list for
* some other reason
+ * @throws NullPointerException if o is null and this list doesn't support
+ * the addition of null values.
*/
void add(int index, Object o);
* type
* @throws IllegalArgumentException if o cannot be added to this list for
* some other reason
+ * @throws NullPointerException if o is null and this list doesn't support
+ * the addition of null values.
*/
boolean add(Object o);
* list due to its type
* @throws IllegalArgumentException if some element of c cannot be added
* to this list for some other reason
+ * @throws NullPointerException if some element of c is null and this list
+ * doesn't support the addition of null values.
* @throws NullPointerException if the specified collection is null
* @see #add(int, Object)
*/
* @throws IllegalArgumentException if some element of c cannot be added
* to this list for some other reason
* @throws NullPointerException if the specified collection is null
+ * @throws NullPointerException if some element of c is null and this list
+ * doesn't support the addition of null values.
* @see #add(Object)
*/
boolean addAll(Collection c);
*
* @param o the element to look for
* @return true if this list contains the element
+ * @throws ClassCastException if the type of o is not a valid type
+ * for this list.
+ * @throws NullPointerException if o is null and the list doesn't
+ * support null values.
*/
boolean contains(Object o);
* @param c the collection to test for
* @return true if for every element o in c, contains(o) would return true
* @throws NullPointerException if the collection is null
+ * @throws ClassCastException if the type of any element in c is not a valid
+ * type for this list.
+ * @throws NullPointerException if some element of c is null and this
+ * list does not support null values.
* @see #contains(Object)
*/
boolean containsAll(Collection c);
*
* @param o the object to search for
* @return the least integer n such that <code>o == null ? get(n) == null :
- * o.equals(get(n))</code>, or -1 if there is no such index
+ * o.equals(get(n))</code>, or -1 if there is no such index.
+ * @throws ClassCastException if the type of o is not a valid
+ * type for this list.
+ * @throws NullPointerException if o is null and this
+ * list does not support null values.
*/
int indexOf(Object o);
* list.
*
* @return the greatest integer n such that <code>o == null ? get(n) == null
- * : o.equals(get(n))</code>, or -1 if there is no such index
+ * : o.equals(get(n))</code>, or -1 if there is no such index.
+ * @throws ClassCastException if the type of o is not a valid
+ * type for this list.
+ * @throws NullPointerException if o is null and this
+ * list does not support null values.
*/
int lastIndexOf(Object o);
* the list contained at least one occurrence of o
* @throws UnsupportedOperationException if this list does not support the
* remove operation
+ * @throws ClassCastException if the type of o is not a valid
+ * type for this list.
+ * @throws NullPointerException if o is null and this
+ * list does not support removing null values.
*/
boolean remove(Object o);
* @throws UnsupportedOperationException if this list does not support the
* removeAll operation
* @throws NullPointerException if the collection is null
+ * @throws ClassCastException if the type of any element in c is not a valid
+ * type for this list.
+ * @throws NullPointerException if some element of c is null and this
+ * list does not support removing null values.
* @see #remove(Object)
* @see #contains(Object)
*/
* @throws UnsupportedOperationException if this list does not support the
* retainAll operation
* @throws NullPointerException if the collection is null
+ * @throws ClassCastException if the type of any element in c is not a valid
+ * type for this list.
+ * @throws NullPointerException if some element of c is null and this
+ * list does not support retaining null values.
* @see #remove(Object)
* @see #contains(Object)
*/
* type
* @throws IllegalArgumentException if o cannot be added to this list for
* some other reason
+ * @throws NullPointerException if o is null and this
+ * list does not support null values.
*/
Object set(int index, Object o);
* @return a List backed by a subsection of this list
* @throws IndexOutOfBoundsException if fromIndex < 0
* || toIndex > size() || fromIndex > toIndex
- * @throws IllegalArgumentException if fromIndex > toIndex (according to
- * AbstractList). Don't you love Sun's inconsistent specifications?
*/
List subList(int fromIndex, int toIndex);
*
* @param value the value to search for
* @return true if the map contains the value
+ * @throws ClassCastException if the type of the value is not a valid type
+ * for this map.
+ * @throws NullPointerException if the value is null and the map doesn't
+ * support null values.
*/
boolean containsValue(Object value);
* @throws ClassCastException if the key or value is of the wrong type
* @throws IllegalArgumentException if something about this key or value
* prevents it from existing in this map
- * @throws NullPointerException if the map forbids null keys or values
+ * @throws NullPointerException if either the key or the value is null,
+ * and the map forbids null keys or values
* @see #containsKey(Object)
*/
Object put(Object key, Object value);
* @param key the key to remove
* @return the value the key mapped to, or null if not present
* @throws UnsupportedOperationException if deletion is unsupported
+ * @throws NullPointerException if the key is null and this map doesn't
+ * support null keys.
+ * @throws ClassCastException if the type of the key is not a valid type
+ * for this map.
*/
- Object remove(Object o);
+ Object remove(Object key);
/**
* Returns the number of key-value mappings in the map. If there are more
*
* @param o the object to look for
* @return true if it is found in the set
+ * @throws ClassCastException if the type of o is not a valid type
+ * for this set.
+ * @throws NullPointerException if o is null and this set doesn't
+ * support null values.
*/
boolean contains(Object o);
* @param c the collection to check membership in
* @return true if all elements in this set are in c
* @throws NullPointerException if c is null
+ * @throws ClassCastException if the type of any element in c is not
+ * a valid type for this set.
+ * @throws NullPointerException if some element of c is null and this
+ * set doesn't support null values.
* @see #contains(Object)
*/
boolean containsAll(Collection c);
* equals, this is the sum of the hashcode of all elements in the set.
*
* @return the sum of the hashcodes of all set elements
+ * @see #equals(Object)
*/
int hashCode();
* @param o the object to remove
* @return true if the set changed (an object was removed)
* @throws UnsupportedOperationException if this operation is not allowed
+ * @throws ClassCastException if the type of o is not a valid type
+ * for this set.
+ * @throws NullPointerException if o is null and this set doesn't allow
+ * the removal of a null value.
*/
boolean remove(Object o);
* @return true if this set changed as a result
* @throws UnsupportedOperationException if this operation is not allowed
* @throws NullPointerException if c is null
+ * @throws ClassCastException if the type of any element in c is not
+ * a valid type for this set.
+ * @throws NullPointerException if some element of c is null and this
+ * set doesn't support removing null values.
* @see #remove(Object)
*/
boolean removeAll(Collection c);
* @return true if this set was modified
* @throws UnsupportedOperationException if this operation is not allowed
* @throws NullPointerException if c is null
+ * @throws ClassCastException if the type of any element in c is not
+ * a valid type for this set.
+ * @throws NullPointerException if some element of c is null and this
+ * set doesn't support retaining null values.
* @see #remove(Object)
*/
boolean retainAll(Collection c);
* Returns the first (lowest sorted) key in the map.
*
* @return the first key
+ * @throws NoSuchElementException if this map is empty.
*/
Object firstKey();
* Returns the last (highest sorted) key in the map.
*
* @return the last key
+ * @throws NoSuchElementException if this map is empty.
*/
Object lastKey();
* Returns the first (lowest sorted) element in the map.
*
* @return the first element
+ * @throws NoSuchElementException if the set is empty.
*/
Object first();
* Returns the last (highest sorted) element in the map.
*
* @return the last element
+ * @throws NoSuchElementException if the set is empty.
*/
Object last();