Top Description Fields Constructors Methods
org.assertj.core.data

public final Class MapEntry<K, V>

extends Object
implements Map.Entry<K, V>
Class Inheritance
All Implemented Interfaces
java.util.Map.Entry
Type Parameters
<K>
the type of the key of this entry.
<V>
the type of the value of this entry.
Static Imports
org.assertj.core.configuration.ConfigurationProvider.CONFIGURATION_PROVIDER

Understands an entry in a Map.
Author
Yvonne Wang

Field Summary

Modifier and TypeField and Description
public final K
public final V

Constructor Summary

AccessConstructor and Description
private
MapEntry(K key, V value)

Method Summary

Modifier and TypeMethod and Description
public static <
the type of the key of this entry.
K
,
the type of the value of this entry.
V
>
MapEntry<K, V>

Returns:

the created MapEntry.
entry
(K
the key of the entry to create.
key
,
V
the value of the entry to create.
value
)

Creates a new MapEntry.

public boolean
equals(Object
object to be compared for equality with this map entry
object
)

Overrides java.lang.Object.equals.

Implements java.util.Map.Entry.equals.

Compares the specified object with this entry for equality.
public K
getKey()

Implements java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.
public V
getValue()

Implements java.util.Map.Entry.getValue.

Returns the value corresponding to this entry.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.Map.Entry.hashCode.

Returns the hash code value for this map entry.
public V

Returns:

(Does not return)
setValue
(V
ignored
value
)

Implements java.util.Map.Entry.setValue.

Always throws UnsupportedOperationException as this class represents an immutable map entry.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

keyback to summary
public final K key
valueback to summary
public final V value

Constructor Detail

MapEntryback to summary
private MapEntry(K key, V value)

Method Detail

entryback to summary
public static <K, V> MapEntry<K, V> entry(K key, V value)

Creates a new MapEntry.

Parameters
<K>
the type of the key of this entry.
<V>
the type of the value of this entry.
key:K

the key of the entry to create.

value:V

the value of the entry to create.

Returns:MapEntry<K, V>

the created MapEntry.

equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Implements java.util.Map.Entry.equals.

Doc from java.util.Map.Entry.equals.

Compares the specified object with this entry for equality. Returns true if the given object is also a map entry and the two entries represent the same mapping. More formally, two entries e1 and e2 represent the same mapping if

    (e1.getKey()==null ?
     e2.getKey()==null : e1.getKey().equals(e2.getKey()))  &&
    (e1.getValue()==null ?
     e2.getValue()==null : e1.getValue().equals(e2.getValue()))
This ensures that the equals method works properly across different implementations of the Map.Entry interface.
Parameters
object:Object

object to be compared for equality with this map entry

Returns:boolean

true if the specified object is equal to this map entry

Annotations
@Override
getKeyback to summary
public K getKey()

Implements java.util.Map.Entry.getKey.

Doc from java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.

Returns:K

the key corresponding to this entry

Annotations
@Override
getValueback to summary
public V getValue()

Implements java.util.Map.Entry.getValue.

Doc from java.util.Map.Entry.getValue.

Returns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator's remove operation), the results of this call are undefined.

Returns:V

the value corresponding to this entry

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.Map.Entry.hashCode.

Doc from java.util.Map.Entry.hashCode.

Returns the hash code value for this map entry. The hash code of a map entry e is defined to be:

    (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.
Returns:int

the hash code value for this map entry

Annotations
@Override
setValueback to summary
public V setValue(V value)

Implements java.util.Map.Entry.setValue.

Always throws UnsupportedOperationException as this class represents an immutable map entry.

Parameters
value:V

ignored

Returns:V

(Does not return)

Annotations
@Override
Exceptions
UnsupportedOperationException:
always
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override