[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath: documentation fixes in java.util

Kaffe CVS cvs-commits at kaffe.org
Wed Aug 18 06:48:45 PDT 2004


PatchSet 5075 
Date: 2004/08/18 13:44:22
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: documentation fixes in java.util

2004-08-18  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/util/AbstractCollection.java,
        libraries/javalib/java/util/AbstractList.java,
        libraries/javalib/java/util/AbstractMap.java,
        libraries/javalib/java/util/AbstractSequentialList.java,
        libraries/javalib/java/util/ArrayList.java,
        libraries/javalib/java/util/AbstractSequentialList.java,
        libraries/javalib/java/util/ArrayList.java,
        libraries/javalib/java/util/Arrays.java,
        libraries/javalib/java/util/BitSet.java,
        libraries/javalib/java/util/Calendar.java,
        libraries/javalib/java/util/Collection.java,
        libraries/javalib/java/util/ListIterator.java,
        librraies/javalib/java/util/Map.java,
        libraries/javalib/java/util/SortedSet.java:
        Resynced with GNU Classpath.

        2004-08-16  Andrew John Hughes  <gnu_andrew at member.fsf.org>

        * java/util/AbstractCollection.java, java/util/AbstractList.java,
        java/util/AbstractMap.java, java/util/AbstractSequentialList.java,
        java/util/ArrayList.java, java/util/Arrays.java,
        java/util/BitSet.java, java/util/Calendar.java,
        java/util/Collection.java, java/util/ListIterator.java,
        java/util/Map.java, java/util/SortedSet.java:
        Added additional exceptions to documentation, along
        with some additions and corrections.

Members: 
	ChangeLog:1.2633->1.2634 
	libraries/javalib/java/util/AbstractCollection.java:1.7->1.8 
	libraries/javalib/java/util/AbstractList.java:1.10->1.11 
	libraries/javalib/java/util/AbstractMap.java:1.7->1.8 
	libraries/javalib/java/util/AbstractSequentialList.java:1.2->1.3 
	libraries/javalib/java/util/ArrayList.java:1.13->1.14 
	libraries/javalib/java/util/Arrays.java:1.11->1.12 
	libraries/javalib/java/util/BitSet.java:1.13->1.14 
	libraries/javalib/java/util/Calendar.java:1.22->1.23 
	libraries/javalib/java/util/Collection.java:1.5->1.6 
	libraries/javalib/java/util/ListIterator.java:1.5->1.6 
	libraries/javalib/java/util/Map.java:1.9->1.10 
	libraries/javalib/java/util/SortedSet.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2633 kaffe/ChangeLog:1.2634
--- kaffe/ChangeLog:1.2633	Wed Aug 18 08:25:11 2004
+++ kaffe/ChangeLog	Wed Aug 18 13:44:22 2004
@@ -1,3 +1,32 @@
+2004-08-18  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/java/util/AbstractCollection.java,
+	libraries/javalib/java/util/AbstractList.java,
+	libraries/javalib/java/util/AbstractMap.java,
+	libraries/javalib/java/util/AbstractSequentialList.java,
+	libraries/javalib/java/util/ArrayList.java,
+	libraries/javalib/java/util/AbstractSequentialList.java,
+	libraries/javalib/java/util/ArrayList.java,
+	libraries/javalib/java/util/Arrays.java,
+	libraries/javalib/java/util/BitSet.java,
+	libraries/javalib/java/util/Calendar.java,
+	libraries/javalib/java/util/Collection.java,
+	libraries/javalib/java/util/ListIterator.java,
+	librraies/javalib/java/util/Map.java,
+	libraries/javalib/java/util/SortedSet.java:
+	Resynced with GNU Classpath.
+
+	2004-08-16  Andrew John Hughes  <gnu_andrew at member.fsf.org>
+
+        * java/util/AbstractCollection.java, java/util/AbstractList.java,
+        java/util/AbstractMap.java, java/util/AbstractSequentialList.java,
+        java/util/ArrayList.java, java/util/Arrays.java,
+        java/util/BitSet.java, java/util/Calendar.java,
+        java/util/Collection.java, java/util/ListIterator.java,
+        java/util/Map.java, java/util/SortedSet.java:
+        Added additional exceptions to documentation, along
+        with some additions and corrections.
+
 2004-08-18  Guilhem Lavaux  <guilhem at kaffe.org>
 
 	* kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
Index: kaffe/libraries/javalib/java/util/AbstractCollection.java
diff -u kaffe/libraries/javalib/java/util/AbstractCollection.java:1.7 kaffe/libraries/javalib/java/util/AbstractCollection.java:1.8
--- kaffe/libraries/javalib/java/util/AbstractCollection.java:1.7	Thu May 15 09:40:31 2003
+++ kaffe/libraries/javalib/java/util/AbstractCollection.java	Wed Aug 18 13:44:24 2004
@@ -129,11 +129,13 @@
    * @return true if the add operation caused the Collection to change
    * @throws UnsupportedOperationException if the add operation is not
    *         supported on this collection
-   * @throws NullPointerException if this collection does not support null,
-   *         or if the specified collection is null
-   * @throws ClassCastException if an object in c is of the wrong type
-   * @throws IllegalArgumentException if some aspect of an object in c prevents
-   *         it from being added
+   * @throws NullPointerException if the specified collection is null
+   * @throws ClassCastException if the type of any element in c is
+   *         not a valid type for addition.
+   * @throws IllegalArgumentException if some aspect of any element
+   *         in c prevents it being added.
+   * @throws NullPointerException if any element in c is null and this
+   *         collection doesn't allow null values.
    * @see #add(Object)
    */
   public boolean addAll(Collection c)
@@ -268,6 +270,7 @@
    * @return true if the remove operation caused the Collection to change
    * @throws UnsupportedOperationException if this collection's Iterator
    *         does not support the remove method
+   * @throws NullPointerException if the collection, c, is null.
    * @see Iterator#remove()
    */
   public boolean removeAll(Collection c)
@@ -288,8 +291,10 @@
    * @return true if the remove operation caused the Collection to change
    * @throws UnsupportedOperationException if this collection's Iterator
    *         does not support the remove method
+   * @throws NullPointerException if the collection, c, is null.
    * @see Iterator#remove()
    */
+  // Package visible for use throughout java.util.
   boolean removeAllInternal(Collection c)
   {
     Iterator itr = iterator();
@@ -316,6 +321,7 @@
    * @return true if the remove operation caused the Collection to change
    * @throws UnsupportedOperationException if this collection's Iterator
    *         does not support the remove method
+   * @throws NullPointerException if the collection, c, is null.
    * @see Iterator#remove()
    */
   public boolean retainAll(Collection c)
@@ -337,8 +343,10 @@
    * @return true if the remove operation caused the Collection to change
    * @throws UnsupportedOperationException if this collection's Iterator
    *         does not support the remove method
+   * @throws NullPointerException if the collection, c, is null.
    * @see Iterator#remove()
    */
+  // Package visible for use throughout java.util.
   boolean retainAllInternal(Collection c)
   {
     Iterator itr = iterator();
Index: kaffe/libraries/javalib/java/util/AbstractList.java
diff -u kaffe/libraries/javalib/java/util/AbstractList.java:1.10 kaffe/libraries/javalib/java/util/AbstractList.java:1.11
--- kaffe/libraries/javalib/java/util/AbstractList.java:1.10	Thu May 15 09:40:31 2003
+++ kaffe/libraries/javalib/java/util/AbstractList.java	Wed Aug 18 13:44:24 2004
@@ -85,7 +85,7 @@
    * <code>add(int, Object)</code> and <code>remove(int)</code> methods.
    * Otherwise, this field may be ignored.
    */
-  protected int modCount;
+  protected transient int modCount;
 
   /**
    * The main constructor, for use by subclasses.
@@ -308,18 +308,43 @@
       private int knownMod = modCount;
 
       // This will get inlined, since it is private.
+      /**
+       * Checks for modifications made to the list from
+       * elsewhere while iteration is in progress.
+       *
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       private void checkMod()
       {
         if (knownMod != modCount)
           throw new ConcurrentModificationException();
       }
 
+      /**
+       * Tests to see if there are any more objects to
+       * return.
+       *
+       * @return True if the end of the list has not yet been
+       *         reached.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public boolean hasNext()
       {
         checkMod();
         return pos < size;
       }
 
+      /**
+       * Retrieves the next object from the list.
+       *
+       * @return The next object.
+       * @throws NoSuchElementException if there are
+       *         no more objects to retrieve.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public Object next()
       {
         checkMod();
@@ -329,6 +354,18 @@
         return get(pos++);
       }
 
+      /**
+       * Removes the last object retrieved by <code>next()</code>
+       * from the list, if the list supports object removal.
+       *
+       * @throws ConcurrentModificationException if the list
+       *         has been modified elsewhere.
+       * @throws IllegalStateException if the iterator is positioned
+       *         before the start of the list or the last object has already
+       *         been removed.
+       * @throws UnsupportedOperationException if the list does
+       *         not support removing elements.
+       */
       public void remove()
       {
         checkMod();
@@ -405,24 +442,58 @@
       private int size = size();
 
       // This will get inlined, since it is private.
+      /**
+       * Checks for modifications made to the list from
+       * elsewhere while iteration is in progress.
+       *
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       private void checkMod()
       {
         if (knownMod != modCount)
           throw new ConcurrentModificationException();
       }
 
+      /**
+       * Tests to see if there are any more objects to
+       * return.
+       *
+       * @return True if the end of the list has not yet been
+       *         reached.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public boolean hasNext()
       {
         checkMod();
         return position < size;
       }
 
+      /**
+       * Tests to see if there are objects prior to the
+       * current position in the list.
+       *
+       * @return True if objects exist prior to the current
+       *         position of the iterator.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public boolean hasPrevious()
       {
         checkMod();
         return position > 0;
       }
 
+      /**
+       * Retrieves the next object from the list.
+       *
+       * @return The next object.
+       * @throws NoSuchElementException if there are no
+       *         more objects to retrieve.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public Object next()
       {
         checkMod();
@@ -432,6 +503,15 @@
         return get(position++);
       }
 
+      /**
+       * Retrieves the previous object from the list.
+       *
+       * @return The next object.
+       * @throws NoSuchElementException if there are no
+       *         previous objects to retrieve.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public Object previous()
       {
         checkMod();
@@ -441,18 +521,47 @@
         return get(lastReturned);
       }
 
+      /**
+       * Returns the index of the next element in the
+       * list, which will be retrieved by <code>next()</code>
+       *
+       * @return The index of the next element.
+       * @throws ConcurrentModificationException if the list
+       *         has been modified elsewhere.
+       */
       public int nextIndex()
       {
         checkMod();
         return position;
       }
 
+      /**
+       * Returns the index of the previous element in the
+       * list, which will be retrieved by <code>previous()</code>
+       *
+       * @return The index of the previous element.
+       * @throws ConcurrentModificationException if the list
+       *         has been modified elsewhere.
+       */
       public int previousIndex()
       {
         checkMod();
         return position - 1;
       }
 
+     /**
+      * Removes the last object retrieved by <code>next()</code>
+      * or <code>previous()</code> from the list, if the list
+      * supports object removal.
+      *
+      * @throws IllegalStateException if the iterator is positioned
+      *         before the start of the list or the last object has already
+      *         been removed.
+      * @throws UnsupportedOperationException if the list does
+      *         not support removing elements.
+      * @throws ConcurrentModificationException if the list
+      *         has been modified elsewhere.
+      */
       public void remove()
       {
         checkMod();
@@ -465,6 +574,24 @@
         knownMod = modCount;
       }
 
+     /**
+      * Replaces the last object retrieved by <code>next()</code>
+      * or <code>previous</code> with o, if the list supports object
+      * replacement and an add or remove operation has not already
+      * been performed.
+      *
+      * @throws IllegalStateException if the iterator is positioned
+      *         before the start of the list or the last object has already
+      *         been removed.
+      * @throws UnsupportedOperationException if the list doesn't support
+      *         the addition or removal of elements.
+      * @throws ClassCastException if the type of o is not a valid type
+      *         for this list.
+      * @throws IllegalArgumentException if something else related to o
+      *         prevents its addition.
+      * @throws ConcurrentModificationException if the list
+      *         has been modified elsewhere.
+      */
       public void set(Object o)
       {
         checkMod();
@@ -473,6 +600,20 @@
         AbstractList.this.set(lastReturned, o);
       }
 
+      /**
+       * Adds the supplied object before the element that would be returned
+       * by a call to <code>next()</code>, if the list supports addition.
+       * 
+       * @param o The object to add to the list.
+       * @throws UnsupportedOperationException if the list doesn't support
+       *         the addition of new elements.
+       * @throws ClassCastException if the type of o is not a valid type
+       *         for this list.
+       * @throws IllegalArgumentException if something else related to o
+       *         prevents its addition.
+       * @throws ConcurrentModificationException if the list
+       *         has been modified elsewhere.
+       */
       public void add(Object o)
       {
         checkMod();
@@ -519,6 +660,8 @@
    *
    * @param fromIndex the index, inclusive, to remove from.
    * @param toIndex the index, exclusive, to remove to.
+   * @throws UnsupportedOperationException if the list does
+   *         not support removing elements.
    */
   protected void removeRange(int fromIndex, int toIndex)
   {
@@ -663,7 +806,7 @@
    * it is not, an exception is thrown.
    *
    * @param index the value to check
-   * @throws IndexOutOfBoundsException if the value is out of range
+   * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt; size()
    */
   // This will get inlined, since it is private.
   private void checkBoundsInclusive(int index)
@@ -678,7 +821,7 @@
    * (exclusive). If it is not, an exception is thrown.
    *
    * @param index the value to check
-   * @throws IndexOutOfBoundsException if the value is out of range
+   * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
    */
   // This will get inlined, since it is private.
   private void checkBoundsExclusive(int index)
@@ -692,6 +835,8 @@
    * Specified by AbstractList.subList to return the private field size.
    *
    * @return the sublist size
+   * @throws ConcurrentModificationException if the backing list has been
+   *         modified externally to this sublist
    */
   public int size()
   {
@@ -705,6 +850,15 @@
    * @param index the location to modify
    * @param o the new value
    * @return the old value
+   * @throws ConcurrentModificationException if the backing list has been
+   *         modified externally to this sublist
+   * @throws UnsupportedOperationException if the backing list does not
+   *         support the set operation
+   * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
+   * @throws ClassCastException if o cannot be added to the backing list due
+   *         to its type
+   * @throws IllegalArgumentException if o cannot be added to the backing list
+   *         for some other reason
    */
   public Object set(int index, Object o)
   {
@@ -718,6 +872,9 @@
    *
    * @param index the location to get from
    * @return the object at that location
+   * @throws ConcurrentModificationException if the backing list has been
+   *         modified externally to this sublist
+   * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
    */
   public Object get(int index)
   {
@@ -731,6 +888,15 @@
    *
    * @param index the index to insert at
    * @param o the object to add
+   * @throws ConcurrentModificationException if the backing list has been
+   *         modified externally to this sublist
+   * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt; size()
+   * @throws UnsupportedOperationException if the backing list does not
+   *         support the add operation.
+   * @throws ClassCastException if o cannot be added to the backing list due
+   *         to its type.
+   * @throws IllegalArgumentException if o cannot be added to the backing
+   *         list for some other reason.
    */
   public void add(int index, Object o)
   {
@@ -746,6 +912,11 @@
    *
    * @param index the index to remove
    * @return the removed object
+   * @throws ConcurrentModificationException if the backing list has been
+   *         modified externally to this sublist
+   * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
+   * @throws UnsupportedOperationException if the backing list does not
+   *         support the remove operation
    */
   public Object remove(int index)
   {
@@ -764,6 +935,10 @@
    *
    * @param fromIndex the lower bound, inclusive
    * @param toIndex the upper bound, exclusive
+   * @throws ConcurrentModificationException if the backing list has been
+   *         modified externally to this sublist
+   * @throws UnsupportedOperationException if the backing list does
+   *         not support removing elements.
    */
   protected void removeRange(int fromIndex, int toIndex)
   {
@@ -780,6 +955,16 @@
    * @param index the location to insert at
    * @param c the collection to insert
    * @return true if this list was modified, in other words, c is non-empty
+   * @throws ConcurrentModificationException if the backing list has been
+   *         modified externally to this sublist
+   * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt; size()
+   * @throws UnsupportedOperationException if this list does not support the
+   *         addAll operation
+   * @throws ClassCastException if some element of c cannot be added to this
+   *         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 the specified collection is null
    */
   public boolean addAll(int index, Collection c)
   {
@@ -797,6 +982,15 @@
    *
    * @param c the collection to insert
    * @return true if this list was modified, in other words, c is non-empty
+   * @throws ConcurrentModificationException if the backing list has been
+   *         modified externally to this sublist
+   * @throws UnsupportedOperationException if this list does not support the
+   *         addAll operation
+   * @throws ClassCastException if some element of c cannot be added to this
+   *         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 the specified collection is null
    */
   public boolean addAll(Collection c)
   {
@@ -819,6 +1013,9 @@
    *
    * @param index the start location of the iterator
    * @return a list iterator over the sublist
+   * @throws ConcurrentModificationException if the backing list has been
+   *         modified externally to this sublist
+   * @throws IndexOutOfBoundsException if the value is out of range
    */
   public ListIterator listIterator(final int index)
   {
@@ -830,18 +1027,45 @@
       private final ListIterator i = backingList.listIterator(index + offset);
       private int position = index;
 
+      /**
+       * Tests to see if there are any more objects to
+       * return.
+       *
+       * @return True if the end of the list has not yet been
+       *         reached.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public boolean hasNext()
       {
         checkMod();
         return position < size;
       }
 
+      /**
+       * Tests to see if there are objects prior to the
+       * current position in the list.
+       *
+       * @return True if objects exist prior to the current
+       *         position of the iterator.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public boolean hasPrevious()
       {
         checkMod();
         return position > 0;
       }
 
+      /**
+       * Retrieves the next object from the list.
+       *
+       * @return The next object.
+       * @throws NoSuchElementException if there are no
+       *         more objects to retrieve.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public Object next()
       {
         if (position == size)
@@ -850,6 +1074,15 @@
         return i.next();
       }
 
+      /**
+       * Retrieves the previous object from the list.
+       *
+       * @return The next object.
+       * @throws NoSuchElementException if there are no
+       *         previous objects to retrieve.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public Object previous()
       {
         if (position == 0)
@@ -858,16 +1091,42 @@
         return i.previous();
       }
 
+      /**
+       * Returns the index of the next element in the
+       * list, which will be retrieved by <code>next()</code>
+       *
+       * @return The index of the next element.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public int nextIndex()
       {
         return i.nextIndex() - offset;
       }
 
+      /**
+       * Returns the index of the previous element in the
+       * list, which will be retrieved by <code>previous()</code>
+       *
+       * @return The index of the previous element.
+       * @throws ConcurrentModificationException if the
+       *         list has been modified elsewhere.
+       */
       public int previousIndex()
       {
         return i.previousIndex() - offset;
       }
 
+      /**
+       * Removes the last object retrieved by <code>next()</code>
+       * from the list, if the list supports object removal.
+       *
+       * @throws IllegalStateException if the iterator is positioned
+       *         before the start of the list or the last object has already
+       *         been removed.
+       * @throws UnsupportedOperationException if the list does
+       *         not support removing elements.
+       */
       public void remove()
       {
         i.remove();
@@ -876,11 +1135,44 @@
         modCount = backingList.modCount;
       }
 
+
+     /**
+      * Replaces the last object retrieved by <code>next()</code>
+      * or <code>previous</code> with o, if the list supports object
+      * replacement and an add or remove operation has not already
+      * been performed.
+      *
+      * @throws IllegalStateException if the iterator is positioned
+      *         before the start of the list or the last object has already
+      *         been removed.
+      * @throws UnsupportedOperationException if the list doesn't support
+      *         the addition or removal of elements.
+      * @throws ClassCastException if the type of o is not a valid type
+      *         for this list.
+      * @throws IllegalArgumentException if something else related to o
+      *         prevents its addition.
+      * @throws ConcurrentModificationException if the list
+      *         has been modified elsewhere.
+      */
       public void set(Object o)
       {
         i.set(o);
       }
 
+      /**
+       * Adds the supplied object before the element that would be returned
+       * by a call to <code>next()</code>, if the list supports addition.
+       * 
+       * @param o The object to add to the list.
+       * @throws UnsupportedOperationException if the list doesn't support
+       *         the addition of new elements.
+       * @throws ClassCastException if the type of o is not a valid type
+       *         for this list.
+       * @throws IllegalArgumentException if something else related to o
+       *         prevents its addition.
+       * @throws ConcurrentModificationException if the list
+       *         has been modified elsewhere.
+       */
       public void add(Object o)
       {
         i.add(o);
Index: kaffe/libraries/javalib/java/util/AbstractMap.java
diff -u kaffe/libraries/javalib/java/util/AbstractMap.java:1.7 kaffe/libraries/javalib/java/util/AbstractMap.java:1.8
--- kaffe/libraries/javalib/java/util/AbstractMap.java:1.7	Tue Aug 12 23:02:19 2003
+++ kaffe/libraries/javalib/java/util/AbstractMap.java	Wed Aug 18 13:44:24 2004
@@ -92,6 +92,21 @@
   }
 
   /**
+   * Returns a set view of the mappings in this Map.  Each element in the
+   * set must be an implementation of Map.Entry.  The set is backed by
+   * the map, so that changes in one show up in the other.  Modifications
+   * made while an iterator is in progress cause undefined behavior.  If
+   * the set supports removal, these methods must be valid:
+   * <code>Iterator.remove</code>, <code>Set.remove</code>,
+   * <code>removeAll</code>, <code>retainAll</code>, and <code>clear</code>.
+   * Element addition is not supported via this set.
+   *
+   * @return the entry set
+   * @see Map.Entry
+   */
+  public abstract Set entrySet();
+
+  /**
    * Remove all entries from this Map (optional operation). This default
    * implementation calls entrySet().clear(). NOTE: If the entry set does
    * not permit clearing, then this will fail, too. Subclasses often
@@ -153,8 +168,9 @@
    * This implementation does a linear search, O(n), over the
    * <code>entrySet()</code>, returning <code>true</code> if a match
    * is found, <code>false</code> if the iteration ends. A match is
-   * defined as <code>(value == null ? v == null : value.equals(v))</code>
-   * Subclasses are unlikely to implement this more efficiently.
+   * defined as a value, v, where <code>(value == null ? v == null :
+   * value.equals(v))</code>.  Subclasses are unlikely to implement
+   * this more efficiently.
    *
    * @param value the value to search for
    * @return true if the map contains the value
@@ -171,21 +187,6 @@
   }
 
   /**
-   * Returns a set view of the mappings in this Map.  Each element in the
-   * set must be an implementation of Map.Entry.  The set is backed by
-   * the map, so that changes in one show up in the other.  Modifications
-   * made while an iterator is in progress cause undefined behavior.  If
-   * the set supports removal, these methods must be valid:
-   * <code>Iterator.remove</code>, <code>Set.remove</code>,
-   * <code>removeAll</code>, <code>retainAll</code>, and <code>clear</code>.
-   * Element addition is not supported via this set.
-   *
-   * @return the entry set
-   * @see Map.Entry
-   */
-  public abstract Set entrySet();
-
-  /**
    * Compares the specified object with this map for equality. Returns
    * <code>true</code> if the other object is a Map with the same mappings,
    * that is,<br>
@@ -277,32 +278,75 @@
     if (keys == null)
       keys = new AbstractSet()
       {
+	/**
+	 * Retrieves the number of keys in the backing map.
+	 *
+	 * @return The number of keys.
+	 */
         public int size()
         {
           return AbstractMap.this.size();
         }
 
+	/**
+	 * Returns true if the backing map contains the
+	 * supplied key.
+	 *
+	 * @param key The key to search for.
+	 * @return True if the key was found, false otherwise.
+	 */
         public boolean contains(Object key)
         {
           return containsKey(key);
         }
 
+	/**
+	 * Returns an iterator which iterates over the keys
+	 * in the backing map, using a wrapper around the
+	 * iterator returned by <code>entrySet()</code>.
+	 *
+	 * @return An iterator over the keys.
+	 */
         public Iterator iterator()
         {
           return new Iterator()
           {
+	    /**
+	     * The iterator returned by <code>entrySet()</code>.
+	     */
             private final Iterator map_iterator = entrySet().iterator();
 
+	    /**
+	     * Returns true if a call to <code>next()</code> will
+	     * return another key.
+	     *
+	     * @return True if the iterator has not yet reached
+	     *         the last key.
+	     */
             public boolean hasNext()
             {
               return map_iterator.hasNext();
             }
 
+	    /**
+	     * Returns the key from the next entry retrieved
+	     * by the underlying <code>entrySet()</code> iterator.
+	     *
+	     * @return The next key.
+	     */
             public Object next()
             {
               return ((Map.Entry) map_iterator.next()).getKey();
             }
 
+	    /**
+	     * Removes the map entry which has a key equal
+	     * to that returned by the last call to
+	     * <code>next()</code>.
+	     *
+	     * @throws UnsupportedOperationException if the
+	     *         map doesn't support removal.
+	     */
             public void remove()
             {
               map_iterator.remove();
@@ -343,11 +387,13 @@
    *
    * @param m the mapping to load into this map
    * @throws UnsupportedOperationException if the operation is not supported
-   * @throws ClassCastException if a key or value is of the wrong type
+   *         by this map.
+   * @throws ClassCastException if a key or value is of the wrong type for
+   *         adding to this map.
    * @throws IllegalArgumentException if something about a key or value
-   *         prevents it from existing in this map
-   * @throws NullPointerException if the map forbids null keys or values, or
-   *         if <code>m</code> is null.
+   *         prevents it from existing in this map.
+   * @throws NullPointerException if the map forbids null keys or values.
+   * @throws NullPointerException if <code>m</code> is null.
    * @see #put(Object, Object)
    */
   public void putAll(Map m)
@@ -372,7 +418,9 @@
    * implementations override it for efficiency.
    *
    * @param key the key to remove
-   * @return the value the key mapped to, or null if not present
+   * @return the value the key mapped to, or null if not present.
+   *         Null may also be returned if null values are allowed
+   *         in the map and the value of this mapping is null.
    * @throws UnsupportedOperationException if deletion is unsupported
    * @see Iterator#remove()
    */
@@ -461,32 +509,76 @@
     if (values == null)
       values = new AbstractCollection()
       {
+	/**
+	 * Returns the number of values stored in
+	 * the backing map.
+	 *
+	 * @return The number of values.
+	 */
         public int size()
         {
           return AbstractMap.this.size();
         }
 
+	/**
+	 * Returns true if the backing map contains
+	 * the supplied value.
+	 *
+	 * @param value The value to search for.
+	 * @return True if the value was found, false otherwise.
+	 */
         public boolean contains(Object value)
         {
           return containsValue(value);
         }
 
+	/**
+	 * Returns an iterator which iterates over the
+	 * values in the backing map, by using a wrapper
+	 * around the iterator returned by <code>entrySet()</code>.
+	 *
+	 * @return An iterator over the values.
+	 */
         public Iterator iterator()
         {
           return new Iterator()
           {
+	    /**
+	     * The iterator returned by <code>entrySet()</code>.
+	     */
             private final Iterator map_iterator = entrySet().iterator();
 
+	    /**
+	     * Returns true if a call to <code>next()</call> will
+	     * return another value.
+	     *
+	     * @return True if the iterator has not yet reached
+	     * the last value.
+	     */
             public boolean hasNext()
             {
               return map_iterator.hasNext();
             }
 
+	    /**
+	     * Returns the value from the next entry retrieved
+	     * by the underlying <code>entrySet()</code> iterator.
+	     *
+	     * @return The next value.
+	     */
             public Object next()
             {
               return ((Map.Entry) map_iterator.next()).getValue();
             }
 
+	    /**
+	     * Removes the map entry which has a key equal
+	     * to that returned by the last call to
+	     * <code>next()</code>.
+	     *
+	     * @throws UnsupportedOperationException if the
+	     *         map doesn't support removal.
+	     */
             public void remove()
             {
               map_iterator.remove();
@@ -533,6 +625,7 @@
    * @author Eric Blake <ebb9 at email.byu.edu>
    */
   // XXX - FIXME Use fully qualified implements as gcj 3.1 workaround.
+  //       Bug still exists in 3.4.1
   static class BasicMapEntry implements Map.Entry
   {
     /**
@@ -627,7 +720,13 @@
      *
      * @param newVal the new value to store
      * @return the old value
-     * @throws NullPointerException if the map forbids null values
+     * @throws NullPointerException if the map forbids null values.
+     * @throws UnsupportedOperationException if the map doesn't support
+     *          <code>put()</code>.
+     * @throws ClassCastException if the value is of a type unsupported
+     *         by the map.
+     * @throws IllegalArgumentException if something else about this
+     *         value prevents it being stored in the map.
      */
     public Object setValue(Object newVal)
     {
Index: kaffe/libraries/javalib/java/util/AbstractSequentialList.java
diff -u kaffe/libraries/javalib/java/util/AbstractSequentialList.java:1.2 kaffe/libraries/javalib/java/util/AbstractSequentialList.java:1.3
--- kaffe/libraries/javalib/java/util/AbstractSequentialList.java:1.2	Tue Aug 12 23:02:19 2003
+++ kaffe/libraries/javalib/java/util/AbstractSequentialList.java	Wed Aug 18 13:44:24 2004
@@ -105,7 +105,9 @@
    * @throws ClassCastException if o cannot be added to this list due to its
    *         type
    * @throws IllegalArgumentException if o cannot be added to this list for
-   *         some other reason
+   *         some other reason.
+   * @throws NullPointerException if o is null and the list does not permit
+   *         the addition of null values.
    */
   public void add(int index, Object o)
   {
@@ -137,6 +139,8 @@
    * @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 an object, o, in c is null and the list
+   *         does not permit the addition of null values.
    * @see #add(int, Object)
    */
   public boolean addAll(int index, Collection c)
@@ -214,6 +218,8 @@
    *         type
    * @throws IllegalArgumentException if o cannot be added to this list for
    *         some other reason
+   * @throws NullPointerException if o is null and the list does not allow
+   *         a value to be set to null.
    */
   public Object set(int index, Object o)
   {
Index: kaffe/libraries/javalib/java/util/ArrayList.java
diff -u kaffe/libraries/javalib/java/util/ArrayList.java:1.13 kaffe/libraries/javalib/java/util/ArrayList.java:1.14
--- kaffe/libraries/javalib/java/util/ArrayList.java:1.13	Thu Apr 22 11:40:44 2004
+++ kaffe/libraries/javalib/java/util/ArrayList.java	Wed Aug 18 13:44:24 2004
@@ -120,7 +120,7 @@
   }
 
   /**
-   * Construct a new ArrayList with the default capcity (16).
+   * Construct a new ArrayList with the default capacity (16).
    */
   public ArrayList()
   {

*** Patch too long, truncated ***



More information about the kaffe mailing list