|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.util.KeyValue
This class stores a pair of a property key, and its corresponding value. It implements Map.Entry interface, so that other classes can use it in the same way, there's no backing Map though, unless stated otherwise.
Constructor Summary | |
KeyValue()
Default Constructor |
|
KeyValue(java.lang.Object key,
java.lang.Object value)
Constructor |
Method Summary | |
boolean |
equals(java.lang.Object o)
Compares the instance of this class with another instance. |
java.lang.Object |
getKey()
Returns the key(key) in the key value pair |
java.lang.Object |
getValue()
Returns the value corresponding to this entry. |
int |
hashCode()
Returns the hash code value for this map entry. |
void |
set(java.lang.Object key,
java.lang.Object value)
Sets the key and value fields |
java.lang.Object |
setValue(java.lang.Object value)
Replaces the value corresponding to this entry with the specified value. |
java.lang.String |
toString()
Converts the key Value pair into a string representation |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public KeyValue(java.lang.Object key, java.lang.Object value)
key
- key of the propertyvalue
- corresponding value of the propertypublic KeyValue()
Method Detail |
public void set(java.lang.Object key, java.lang.Object value)
key
- key of the propertyvalue
- corresponding value of the propertypublic boolean equals(java.lang.Object o)
equals
in interface java.util.Map.Entry
o
- Another instance of the KeyValue class to which it
has to be compared.public java.lang.String toString()
public java.lang.Object getKey()
getKey
in interface java.util.Map.Entry
public java.lang.Object getValue()
getValue
in interface java.util.Map.Entry
public java.lang.Object setValue(java.lang.Object value)
setValue
in interface java.util.Map.Entry
value
- new value to be stored in this entry.
public int hashCode()
(e.getKey()==null ? 0 : e.getKey().hashCode()) ^ (e.getValue()==null ? 0 : e.getValue().hashCode())This ensures that e1.equals(e2) implies that e1.hashCode()==e2.hashCode() for any two Entries e1 and e2, as required by the general contract of Object.hashCode.
hashCode
in interface java.util.Map.Entry
Object.hashCode()
,
Object.equals(Object)
,
equals(Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |