commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections LRUMap.java
Date Thu, 09 May 2002 03:10:46 GMT
mas         02/05/08 20:10:46

  Modified:    collections/src/java/org/apache/commons/collections
                        LRUMap.java
  Log:
  Fixed to ensure that get(Object) won't add a mapping to a null value
  when one didn't exist before.  That is, if containsKey(foo) returns
  false, then get(foo) will not change that.
  
  Added serial version UID to maintain backwards compatibility.  The auto
  generated serialization UID differs from the released version because
  of the addition of a new method.
  
  Revision  Changes    Path
  1.15      +10 -4     jakarta-commons/collections/src/java/org/apache/commons/collections/LRUMap.java
  
  Index: LRUMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/LRUMap.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- LRUMap.java	8 May 2002 18:11:36 -0000	1.14
  +++ LRUMap.java	9 May 2002 03:10:46 -0000	1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/LRUMap.java,v
1.14 2002/05/08 18:11:36 morgand Exp $
  - * $Revision: 1.14 $
  - * $Date: 2002/05/08 18:11:36 $
  + * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/LRUMap.java,v
1.15 2002/05/09 03:10:46 mas Exp $
  + * $Revision: 1.15 $
  + * $Date: 2002/05/09 03:10:46 $
    *
    * ====================================================================
    *
  @@ -131,6 +131,8 @@
        *         null value <i>or</i> if the key has no value.
        */
       public Object get(Object key) {
  +        if(!containsKey(key)) return null;
  +
           Object value = remove(key);
           super.put(key,value);
           return value;
  @@ -240,5 +242,9 @@
               removeLRU();
           }
       }
  -        
  +
  +
  +    // add a serial version uid, so that if we change things in the future
  +    // without changing the format, we can still deserialize properly.
  +    private static final long serialVersionUID = 2197433140769957051L;
   }
  
  
  

--
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