Class Pair<K,V>

java.lang.Object
de.espirit.common.util.Pair<K,V>
All Implemented Interfaces:
Serializable, Map.Entry<K,V>

public class Pair<K,V> extends Object implements Serializable, Map.Entry<K,V>
Container for a pair of objects, usually a key and a value.
Since:
4.2.34
See Also:
  • Constructor Details

  • Method Details

    • create

      public static <K, V> Pair<K,V> create(@Nullable K key, @Nullable V value)
      Create a pair with the given key and value.
      Parameters:
      key - key of the pair
      value - value of the pair
      Since:
      4.2.34
    • getKey

      public K getKey()
      The key of the pair.
      Specified by:
      getKey in interface Map.Entry<K,V>
      Since:
      4.2.34
    • setKey

      public void setKey(K key)
      Set the key of the pair, null keys are allowed.
      Since:
      4.2.34
    • getValue

      public V getValue()
      Returns the value corresponding to this pair. The value may be null.
      Specified by:
      getValue in interface Map.Entry<K,V>
      Returns:
      Returns the value corresponding to this pair.
      Since:
      4.2.34
    • setValue

      public V setValue(V value)
      Set the value of the pair, null values are allowed.
      Specified by:
      setValue in interface Map.Entry<K,V>
      Since:
      4.2.34