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. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130699 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
33f0ab0d46
commit
09e7a4b86e
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/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/jerenkrantz/tmp/commons/commons-convert/cvs/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 @@ public class LRUMap extends SequencedHashMap implements Externalizable {
|
|||
* 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 @@ public class LRUMap extends SequencedHashMap implements Externalizable {
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue