org.apache.commons.collections.keyvalue
public class DefaultKeyValue extends AbstractKeyValue
KeyValue
pair that does not implement
java.util.Map.Entry Map.Entry
.
Note that a DefaultKeyValue
instance may not contain
itself as a key or value.
Since: Commons Collections 3.0
Version: $Revision: 405927 $ $Date: 2006-05-12 23:57:03 +0100 (Fri, 12 May 2006) $
Constructor Summary | |
---|---|
DefaultKeyValue()
Constructs a new pair with a null key and null value. | |
DefaultKeyValue(Object key, Object value)
Constructs a new pair with the specified key and given value.
| |
DefaultKeyValue(KeyValue pair)
Constructs a new pair from the specified KeyValue .
| |
DefaultKeyValue(Entry entry)
Constructs a new pair from the specified Map.Entry .
|
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 | setKey(Object key)
Sets the key.
|
Object | setValue(Object value)
Sets the value.
|
Entry | toMapEntry()
Returns a new Map.Entry object with key and value from this pair.
|
Parameters: key the key for the entry, may be null value the value for the entry, may be null
KeyValue
.
Parameters: pair the pair to copy, must not be null
Throws: NullPointerException if the entry is null
Map.Entry
.
Parameters: entry the entry to copy, must not be null
Throws: NullPointerException if the entry is null
Map.Entry
with another Map.Entry
.
Returns true if the compared object is also a DefaultKeyValue
,
and its key and value are equal to this object's key and value.
Parameters: obj the object to compare to
Returns: true if equal key and value
Implemented per API documentation of java.util.Map.Entry#hashCode(), however subclasses may override this.
Returns: a suitable hash code
Parameters: key the new key
Returns: the old key
Throws: IllegalArgumentException if key is this object
Parameters: value the new value
Returns: the old value of the value
Throws: IllegalArgumentException if value is this object
Map.Entry
object with key and value from this pair.
Returns: a MapEntry instance