|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.collections.keyvalue.AbstractKeyValue<K,V>
org.apache.commons.collections.keyvalue.DefaultKeyValue<K,V>
public class DefaultKeyValue<K,V>
A mutable KeyValue pair that does not implement MapEntry.
Note that aDefaultKeyValue 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<K,V> pair)
Constructs a new pair from the specified KeyValue. |
|
DefaultKeyValue(K key,
V value)
Constructs a new pair with the specified key and given value. |
|
DefaultKeyValue(Map.Entry<K,V> entry)
Constructs a new pair from the specified MapEntry. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
Compares this Map Entry with another Map Entry. |
int |
hashCode()
Gets a hashCode compatible with the equals method. |
K |
setKey(K key)
Sets the key. |
V |
setValue(V value)
Sets the value. |
Map.Entry<K,V> |
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(K key,
V value)
key - the key for the entry, may be nullvalue - the value for the entry, may be nullpublic DefaultKeyValue(KeyValue<K,V> pair)
pair - the pair to copy, must not be null
NullPointerException - if the entry is nullpublic DefaultKeyValue(Map.Entry<K,V> entry)
entry - the entry to copy, must not be null
NullPointerException - if the entry is null| Method Detail |
|---|
public K setKey(K key)
key - the new key
IllegalArgumentException - if key is this objectpublic V setValue(V value)
value - the new value
IllegalArgumentException - if value is this objectpublic Map.Entry<K,V> toMapEntry()
Map.Entry object with key and value from this pair.
public boolean equals(Object obj)
DefaultKeyValue,
and its key and value are equal to this object's key and value.
equals in class Objectobj - the object to compare to
public int hashCode()
Map.Entry.hashCode(),
however subclasses may override this.
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||