|
LimeWire Collection Component API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.limewire.collection.KeyValue<K,V>
public class KeyValue<K,V>
Stores a property key and its corresponding value pair. KeyValue
implements Map.Entry, but there's no backing map.
System.out.println(new KeyValue<String, String>("myKey", "myValue"));
Output:
myKey = myValue
| Constructor Summary | |
|---|---|
KeyValue()
Default Constructor |
|
KeyValue(K key,
V value)
Constructor |
|
| Method Summary | |
|---|---|
boolean |
equals(Object o)
Compares the instance of this class with another instance. |
K |
getKey()
Returns the key(key) in the key value pair |
V |
getValue()
Returns the value corresponding to this entry. |
int |
hashCode()
Returns the hash code value for this map entry. |
void |
set(K key,
V value)
Sets the key and value fields |
V |
setValue(V value)
Replaces the value corresponding to this entry with the specified value. |
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(K key,
V value)
key - key of the propertyvalue - corresponding value of the propertypublic KeyValue()
| Method Detail |
|---|
public void set(K key,
V value)
key - key of the propertyvalue - corresponding value of the propertypublic boolean equals(Object o)
equals in interface Map.Entry<K,V>equals in class Objecto - Another instance of the KeyValue class to which it
has to be compared.public String toString()
toString in class Objectpublic K getKey()
getKey in interface Map.Entry<K,V>public V getValue()
getValue in interface Map.Entry<K,V>public V setValue(V value)
setValue in interface Map.Entry<K,V>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 Map.Entry<K,V>hashCode in class ObjectObject.hashCode(),
Object.equals(Object),
equals(Object)
|
LimeWire Collection Component API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||