commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections MultiHashMap.java
Date Sun, 24 Nov 2002 20:25:56 GMT
scolebourne    2002/11/24 12:25:55

  Modified:    collections/src/java/org/apache/commons/collections
                        MultiHashMap.java
  Log:
  Remove map key collection when it becomes empty so equals works.
  from Serhiy Yevtushenko
  
  Revision  Changes    Path
  1.9       +10 -3     jakarta-commons/collections/src/java/org/apache/commons/collections/MultiHashMap.java
  
  Index: MultiHashMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/MultiHashMap.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MultiHashMap.java	24 Nov 2002 19:36:48 -0000	1.8
  +++ MultiHashMap.java	24 Nov 2002 20:25:55 -0000	1.9
  @@ -96,6 +96,7 @@
    * @author Steve Downey
    * @author Stephen Colebourne
    * @author <a href="mailto:jburet@yahoo.com">Julien Buret</a>
  + * @author Serhiy Yevtushenko
    */
   public class MultiHashMap extends HashMap implements MultiMap {
       // deprecated name concept
  @@ -254,6 +255,12 @@
               return null;
           }
           valuesForKey.remove(item);
  +
  +        // remove the list if it is now empty
  +        // (saves space, and allows equals to work)
  +        if (valuesForKey.isEmpty()){
  +            remove(key);
  +        }
           return item;
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message