|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.collections.keyvalue.AbstractKeyValue org.apache.commons.collections.keyvalue.DefaultKeyValue
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.
Field Summary |
---|
Fields inherited from class org.apache.commons.collections.keyvalue.AbstractKeyValue |
---|
key, value |
Constructor Summary | |
---|---|
DefaultKeyValue()
Constructs a new pair with a null key and null value. |
|
DefaultKeyValue(KeyValue pair)
Constructs a new pair from the specified KeyValue . |
|
DefaultKeyValue(java.util.Map.Entry entry)
Constructs a new pair from the specified Map.Entry . |
|
DefaultKeyValue(java.lang.Object key,
java.lang.Object value)
Constructs a new pair with the specified key and given value. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Compares this Map.Entry with another Map.Entry . |
int |
hashCode()
Gets a hashCode compatible with the equals method. |
java.lang.Object |
setKey(java.lang.Object key)
Sets the key. |
java.lang.Object |
setValue(java.lang.Object value)
Sets the value. |
java.util.Map.Entry |
toMapEntry()
Returns a new Map.Entry object with key and value from this pair. |
Methods inherited from class org.apache.commons.collections.keyvalue.AbstractKeyValue |
---|
getKey, getValue, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DefaultKeyValue()
public DefaultKeyValue(java.lang.Object key, java.lang.Object value)
key
- the key for the entry, may be nullvalue
- the value for the entry, may be nullpublic DefaultKeyValue(KeyValue pair)
KeyValue
.
pair
- the pair to copy, must not be null
java.lang.NullPointerException
- if the entry is nullpublic DefaultKeyValue(java.util.Map.Entry entry)
Map.Entry
.
entry
- the entry to copy, must not be null
java.lang.NullPointerException
- if the entry is nullMethod Detail |
---|
public java.lang.Object setKey(java.lang.Object key)
key
- the new key
java.lang.IllegalArgumentException
- if key is this objectpublic java.lang.Object setValue(java.lang.Object value)
value
- the new value
java.lang.IllegalArgumentException
- if value is this objectpublic java.util.Map.Entry toMapEntry()
Map.Entry
object with key and value from this pair.
public boolean equals(java.lang.Object obj)
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.
equals
in class java.lang.Object
obj
- the object to compare to
public int hashCode()
Implemented per API documentation of Map.Entry.hashCode()
,
however subclasses may override this.
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |