org.apache.commons.collections.keyvalue
Class DefaultKeyValue
- KeyValue
public class DefaultKeyValue
A mutable
KeyValue pair that does not implement
Map.Entry.
Note that a
DefaultKeyValue instance may not contain
itself as a key or value.
$Revision: 405927 $ $Date: 2006-05-12 23:57:03 +0100 (Fri, 12 May 2006) $- James Strachan
- Michael A. Smith
- Neil O'Toole
- Stephen Colebourne
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.
|
Map.Entry | toMapEntry()- Returns a new
Map.Entry object with key and value from this pair.
|
DefaultKeyValue
public DefaultKeyValue()
Constructs a new pair with a null key and null value.
DefaultKeyValue
public DefaultKeyValue(Map.Entry entry)
Constructs a new pair from the specified Map.Entry.
entry - the entry to copy, must not be null
DefaultKeyValue
public DefaultKeyValue(Object key,
Object value) Constructs a new pair with the specified key and given value.
key - the key for the entry, may be nullvalue - the value for the entry, may be null
DefaultKeyValue
public DefaultKeyValue(KeyValue pair)
Constructs a new pair from the specified KeyValue.
pair - the pair to copy, must not be null
equals
public boolean equals(Object obj)
Compares this
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.
obj - the object to compare to
- true if equal key and value
hashCode
public int hashCode()
Gets a hashCode compatible with the equals method.
Implemented per API documentation of
java.util.Map.Entry.hashCode(),
however subclasses may override this.
setKey
public Object setKey(Object key)
Sets the key.
setValue
public Object setValue(Object value)
Sets the value.
- the old value of the value
toMapEntry
public Map.Entry toMapEntry()
Returns a new Map.Entry object with key and value from this pair.
Copyright © 2001-2015 Apache Software Foundation. All Rights Reserved.