Class DefaultKeyValue<K,V> 
java.lang.Object
org.apache.commons.collections4.keyvalue.AbstractKeyValue<K,V>
 
org.apache.commons.collections4.keyvalue.DefaultKeyValue<K,V> 
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a new pair with a null key and null value.DefaultKeyValue(Map.Entry<? extends K, ? extends V> entry) Constructs a new pair from the specifiedMap.Entry.DefaultKeyValue(K key, V value) Constructs a new pair with the specified key and given value.DefaultKeyValue(KeyValue<? extends K, ? extends V> pair) Constructs a new pair from the specifiedKeyValue.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanCompares thisMap.Entrywith anotherMap.Entry.inthashCode()Gets a hashCode compatible with the equals method.Sets the key.Sets the value.Returns a newMap.Entryobject with key and value from this pair.Methods inherited from class org.apache.commons.collections4.keyvalue.AbstractKeyValuegetKey, getValue, toString
- 
Constructor Details- 
DefaultKeyValuepublic DefaultKeyValue()Constructs a new pair with a null key and null value.
- 
DefaultKeyValueConstructs a new pair with the specified key and given value.- Parameters:
- key- the key for the entry, may be null
- value- the value for the entry, may be null
 
- 
DefaultKeyValueConstructs a new pair from the specifiedKeyValue.- Parameters:
- pair- the pair to copy, must not be null
- Throws:
- NullPointerException- if the entry is null
 
- 
DefaultKeyValueConstructs a new pair from the specifiedMap.Entry.- Parameters:
- entry- the entry to copy, must not be null
- Throws:
- NullPointerException- if the entry is null
 
 
- 
- 
Method Details- 
equalsCompares thisMap.Entrywith anotherMap.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.
- 
hashCodeGets a hashCode compatible with the equals method.Implemented per API documentation of Map.Entry.hashCode(), however subclasses may override this.
- 
setKeySets the key.- Overrides:
- setKeyin class- AbstractKeyValue<K,- V> 
- Parameters:
- key- the new key
- Returns:
- the old key
- Throws:
- IllegalArgumentException- if key is this object
 
- 
setValueSets the value.- Overrides:
- setValuein class- AbstractKeyValue<K,- V> 
- Parameters:
- value- the new value
- Returns:
- the old value of the value
- Throws:
- IllegalArgumentException- if value is this object
 
- 
toMapEntryReturns a newMap.Entryobject with key and value from this pair.- Returns:
- a MapEntry instance
 
 
-