Package java.util
Interface Map.Entry<K,V>
- All Known Implementing Classes:
AbstractMap.SimpleEntry,AbstractMap.SimpleImmutableEntry
public static interface Map.Entry<K,V>
Map.Entry is a key/value mapping contained in a Map.-
Method Summary
Modifier and Type Method Description booleanequals(Object object)Compares the specified object to thisMap.Entryand returns if they are equal.KgetKey()Returns the key.VgetValue()Returns the value.inthashCode()Returns an integer hash code for the receiver.VsetValue(V object)Sets the value of this entry to the specified value, replacing any existing value.
-
Method Details
-
equals
Compares the specified object to thisMap.Entryand returns if they are equal. To be equal, the object must be an instance ofMap.Entryand have the same key and value.- Overrides:
equalsin classObject- Parameters:
object- theObjectto compare with thisObject.- Returns:
trueif the specifiedObjectis equal to thisMap.Entry,falseotherwise.- See Also:
hashCode()
-
getKey
K getKey()Returns the key.- Returns:
- the key
-
getValue
V getValue()Returns the value.- Returns:
- the value
-
hashCode
int hashCode()Returns an integer hash code for the receiver.Objectwhich are equal return the same value for this method.- Overrides:
hashCodein classObject- Returns:
- the receiver's hash code.
- See Also:
equals(Object)
-
setValue
Sets the value of this entry to the specified value, replacing any existing value.- Parameters:
object- the new value to set.- Returns:
- object the replaced value of this entry.
-