org.apache.commons.collections.keyvalue
Class AbstractMapEntry
java.lang.Object
|
+--org.apache.commons.collections.keyvalue.AbstractKeyValue
|
+--org.apache.commons.collections.keyvalue.AbstractMapEntry
- All Implemented Interfaces:
- KeyValue, Map.Entry
- Direct Known Subclasses:
- BeanMap.MyMapEntry, DefaultMapEntry, UnmodifiableMapEntry
- public abstract class AbstractMapEntry
- extends AbstractKeyValue
- implements Map.Entry
Abstract Pair class to assist with creating correct Map Entry implementations.
- Since:
- Commons Collections 3.0
- Version:
- $Revision: 1.3 $ $Date: 2004/01/14 21:43:16 $
- Author:
- James Strachan, Michael A. Smith, Neil O'Toole, Stephen Colebourne
Method Summary |
boolean |
equals(Object obj)
Compares this Map Entry with another Map Entry. |
int |
hashCode()
Gets a hashCode compatible with the equals method. |
Object |
setValue(Object value)
Sets the value stored in this Map Entry. |
AbstractMapEntry
protected AbstractMapEntry(Object key,
Object value)
- Constructs a new entry with the given key and given value.
- Parameters:
key
- the key for the entry, may be nullvalue
- the value for the entry, may be null
setValue
public Object setValue(Object value)
- Sets the value stored in this Map Entry.
This Map Entry is not connected to a Map, so only the local data is changed.
- Specified by:
setValue
in interface Map.Entry
- Parameters:
value
- the new value- Returns:
- the previous value
equals
public boolean equals(Object obj)
- Compares this Map Entry with another Map Entry.
Implemented per API documentation of Map.Entry.equals(Object)
- Specified by:
equals
in interface Map.Entry
- Overrides:
equals
in class Object
- Parameters:
obj
- the object to compare to- Returns:
- true if equal key and value
hashCode
public int hashCode()
- Gets a hashCode compatible with the equals method.
Implemented per API documentation of Map.Entry.hashCode()
- Specified by:
hashCode
in interface Map.Entry
- Overrides:
hashCode
in class Object
- Returns:
- a suitable hash code
Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.