Module javafx.base
Package javafx.util

Class Pair<K,V>

java.lang.Object
javafx.util.Pair<K,V>
Type Parameters:
K - the key (name) type
V - the value type
All Implemented Interfaces:
Serializable

public class Pair<K,V> extends Object implements Serializable
A convenience class to represent name-value pairs.
Since:
JavaFX 2.0
See Also:
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Pair(K key, V value)
    Creates a new pair
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    boolean
    Test this Pair for equality with another Object.
    Gets the key for this pair.
    Gets the value for this pair.
    int
    Generate a hash code for this Pair.
    String representation of this Pair.

    Methods declared in class java.lang.Object Link icon

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details Link icon

    • Pair Link icon

      public Pair(K key, V value)
      Creates a new pair
      Parameters:
      key - The key for this pair
      value - The value to use for this pair
  • Method Details Link icon

    • getKey Link icon

      public K getKey()
      Gets the key for this pair.
      Returns:
      key for this pair
    • getValue Link icon

      public V getValue()
      Gets the value for this pair.
      Returns:
      value for this pair
    • toString Link icon

      public String toString()

      String representation of this Pair.

      The default name/value delimiter '=' is always used.

      Overrides:
      toString in class Object
      Returns:
      String representation of this Pair
    • hashCode Link icon

      public int hashCode()

      Generate a hash code for this Pair.

      The hash code is calculated using both the name and the value of the Pair.

      Overrides:
      hashCode in class Object
      Returns:
      hash code for this Pair
    • equals Link icon

      public boolean equals(Object o)

      Test this Pair for equality with another Object.

      If the Object to be tested is not a Pair or is null, then this method returns false.

      Two Pairs are considered equal if and only if both the names and values are equal.

      Overrides:
      equals in class Object
      Parameters:
      o - the Object to test for equality with this Pair
      Returns:
      true if the given Object is equal to this Pair else false