public static class AbstractMap.SimpleEntry<K, V>
- Object
- AbstractMap.SimpleEntry
ImplementsMap.Entry<K, V>
A key-value mapping.
Type parameter K: the type of key
Type parameter V: the type of value
Constructors
public SimpleEntry(K theKey, V theValue) | Constructs a new instance by key and value. |
public SimpleEntry(Map.Entry<? extends K, ? extends V> entry) | Constructs a new instance by an entry |
Methods
public K getKey() | Returns the key. |
public V getValue() | Returns the value. |
public V setValue(V object) | Sets the value of this entry to the specified value, replacing any existing value. |
public boolean equals(Object object) | Answers whether the object is equal to this entry. |
public int hashCode() | Answers the hash code of this entry. |
public String toString() | Answers a String representation of this entry. |
Inherited methods
Constructor details
SimpleEntry
public SimpleEntry(K theKey, V theValue)Constructs a new instance by key and value.
Parameters
theKeyK- the key
theValueV- the value
SimpleEntry
public SimpleEntry(Map.Entry<? extends K, ? extends V> entry)Constructs a new instance by an entry
Parameters
entryMap.Entry<? extends K, ? extends V>- the entry
Method details
getKey
public K getKey()Returns the key.
Returns
the key
See also
getValue
public V getValue()Returns the value.
Returns
the value
See also
setValue
public V setValue(V object)Sets the value of this entry to the specified value, replacing any
existing value.
Parameters
objectV- the new value to set.
Returns
object the replaced value of this entry.
equals
public boolean equals(Object object)Answers whether the object is equal to this entry. This works across
all kinds of the Map.Entry interface.
hashCode
public int hashCode()Answers the hash code of this entry.
See also
toString
public String toString()Answers a String representation of this entry.