|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hippoecm.hst.util.DefaultKeyValue<K,V>
public class DefaultKeyValue<K,V>
An implementation of KeyValue
to provide a simple key value pair.
A Map Entry has considerable additional semantics over and above a simple key-value pair.
Constructor Summary | |
---|---|
DefaultKeyValue(KeyValue<K,V> pair)
Constructs a new pair from the specified KeyValue . |
|
DefaultKeyValue(KeyValue<K,V> pair,
boolean compareByKeyOnly)
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(K key,
V value,
boolean compareByKeyOnly)
Constructs a new pair with the specified key and given value. |
|
DefaultKeyValue(Map.Entry<K,V> entry)
Constructs a new pair from the specified Map.Entry . |
|
DefaultKeyValue(Map.Entry<K,V> entry,
boolean compareByKeyOnly)
Constructs a new pair from the specified Map.Entry . |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Compares this KeyValue with another KeyValue . |
K |
getKey()
Gets the key from the pair. |
V |
getValue()
Gets the value from the pair. |
int |
hashCode()
Gets a hashCode compatible with the equals method. |
K |
setKey(K key)
Sets the key. |
V |
setValue(V value)
Sets the value. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultKeyValue(K key, V value)
key
- the key for the entry, may be nullvalue
- the value for the entry, may be nullpublic DefaultKeyValue(K key, V value, boolean compareByKeyOnly)
key
- the key for the entry, may be nullvalue
- the value for the entry, may be nullcompareByKeyOnly
- flag if equals() depends on key onlypublic DefaultKeyValue(KeyValue<K,V> pair)
KeyValue
.
pair
- the pair to copy, must not be null
NullPointerException
- if the entry is nullpublic DefaultKeyValue(KeyValue<K,V> pair, boolean compareByKeyOnly)
KeyValue
.
pair
- the pair to copy, must not be nullcompareByKeyOnly
- flag if equals() depends on key only
NullPointerException
- if the entry is nullpublic DefaultKeyValue(Map.Entry<K,V> entry)
Map.Entry
.
entry
- the entry to copy, must not be null
NullPointerException
- if the entry is nullpublic DefaultKeyValue(Map.Entry<K,V> entry, boolean compareByKeyOnly)
Map.Entry
.
entry
- the entry to copy, must not be nullcompareByKeyOnly
- flag if equals() depends on key only
NullPointerException
- if the entry is nullMethod Detail |
---|
public K getKey()
getKey
in interface KeyValue<K,V>
public V getValue()
getValue
in interface KeyValue<K,V>
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 boolean equals(Object obj)
KeyValue
with another KeyValue
.
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 Object
obj
- the object to compare to
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |