Class MapEntry<K,V>

java.lang.Object
org.assertj.core.data.MapEntry<K,V>
Type Parameters:
K - the type of the key of this entry.
V - the type of the value of this entry.
All Implemented Interfaces:
Map.Entry<K,V>

public class MapEntry<K,V> extends Object implements Map.Entry<K,V>
Understands an entry in a Map.
  • Field Details

    • key

      public final K key
    • value

      public final V value
  • Constructor Details

    • MapEntry

      private MapEntry(K key, V value)
  • Method Details

    • entry

      public static <K, V> MapEntry<K,V> entry(K key, V value)
      Creates a new MapEntry.
      Type Parameters:
      K - the type of the key of this entry.
      V - the type of the value of this entry.
      Parameters:
      key - the key of the entry to create.
      value - the value of the entry to create.
      Returns:
      the created MapEntry.
    • equals

      public boolean equals(Object object)
      Specified by:
      equals in interface Map.Entry<K,V>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map.Entry<K,V>
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getKey

      public K getKey()
      Specified by:
      getKey in interface Map.Entry<K,V>
    • getValue

      public V getValue()
      Specified by:
      getValue in interface Map.Entry<K,V>
    • setValue

      public V setValue(V value)
      Always throws UnsupportedOperationException, as this class represents an immutable map entry.
      Specified by:
      setValue in interface Map.Entry<K,V>
      Parameters:
      value - ignored
      Returns:
      (Does not return)
      Throws:
      UnsupportedOperationException - always