public static class AbstractMap.SimpleEntry<K, V>

  1. Object
  2. 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

theKey K
the key
theValue V
the value

SimpleEntry

public SimpleEntry(Map.Entry<? extends K, ? extends V> entry)
Constructs a new instance by an entry

Parameters

entry Map.Entry<? extends K, ? extends V>
the entry

Method details

getKey

public K getKey()
Returns the key.

Returns

the key

getValue

public V getValue()
Returns the value.

Returns

the value

setValue

public V setValue(V object)
Sets the value of this entry to the specified value, replacing any existing value.

Parameters

object V
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.

toString

public String toString()
Answers a String representation of this entry.