You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2002/04/08 12:11:18 UTC

cvs commit: jakarta-avalon-excalibur/collections/src/java/org/apache/avalon/excalibur/collections BucketMap.java

leif        02/04/08 03:11:17

  Modified:    collections/src/java/org/apache/avalon/excalibur/collections
                        BucketMap.java
  Log:
  Add some comments.
  
  Revision  Changes    Path
  1.15      +9 -1      jakarta-avalon-excalibur/collections/src/java/org/apache/avalon/excalibur/collections/BucketMap.java
  
  Index: BucketMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/collections/src/java/org/apache/avalon/excalibur/collections/BucketMap.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- BucketMap.java	26 Mar 2002 10:45:21 -0000	1.14
  +++ BucketMap.java	8 Apr 2002 10:11:17 -0000	1.15
  @@ -19,7 +19,7 @@
    *
    * @author  <a href="bloritsch@apache.org">Berin Loritsch</a>
    * @author  <a href="g-froehlich@gmx.de">Gerhard Froehlich</a>
  - * @version CVS $Revision: 1.14 $ $Date: 2002/03/26 10:45:21 $
  + * @version CVS $Revision: 1.15 $ $Date: 2002/04/08 10:11:17 $
    * @since 4.0
    */
   public final class BucketMap implements Map
  @@ -142,6 +142,9 @@
                   return value;
               }
   
  +            // Set n to the last node in the linked list.  Check each key along the way
  +            //  If the key is found, then change the value of that node and return
  +            //  the old value.
               for( Node next = n; next != null; next = next.next )
               {
                   n = next;
  @@ -154,6 +157,8 @@
                   }
               }
   
  +            // The key was not found in the current list of nodes, add it to the end
  +            //  in a new node.
               Node newNode = new Node();
               newNode.key = key;
               newNode.value = value;
  @@ -354,12 +359,15 @@
               {
                   if( n.key.equals( key ) )
                   {
  +                    // Remove this node from the linked list of nodes.
                       if( null == prev )
                       {
  +                        // This node was the head, set the next node to be the new head.
                           m_buckets[ hash ] = n.next;
                       }
                       else
                       {
  +                        // Set the next node of the previous node to be the node after this one.
                           prev.next = n.next;
                       }
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>