costin      00/12/27 13:23:18

  Modified:    src/share/org/apache/tomcat/util/collections
                        SimpleHashtable.java
  Log:
  Added the missing remove() method.
  
  Revision  Changes    Path
  1.2       +20 -3     
jakarta-tomcat/src/share/org/apache/tomcat/util/collections/SimpleHashtable.java
  
  Index: SimpleHashtable.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/collections/SimpleHashtable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleHashtable.java      2000/11/30 17:34:17     1.1
  +++ SimpleHashtable.java      2000/12/27 21:23:17     1.2
  @@ -97,7 +97,7 @@
    * it makes a significant difference when normalizing attributes,
    * which is done for each start-element construct.
    *
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public final class SimpleHashtable implements Enumeration
   {
  @@ -308,8 +308,25 @@
        return null;
       }
   
  -    public void remove(Object o) {
  -     
  +    public Object remove(Object key) {
  +     Entry tab[] = table;
  +     Entry prev=null;
  +     int hash = key.hashCode();
  +     int index = (hash & 0x7FFFFFFF) % tab.length;
  +     for (Entry e = tab[index] ; e != null ; prev=e, e = e.next) {
  +         if ((e.hash == hash) && e.key.equals(key)) {
  +             if( prev!=null ) {
  +                 prev.next=e.next;
  +             } else {
  +                 tab[index]=e.next;
  +             }
  +         }
  +         count--;
  +         Object res=e.value;
  +         e.value=null;
  +         return res;
  +     }
  +     return null;
       }
   
       /**
  
  
  

Reply via email to