Class Pair

  • All Implemented Interfaces:
    Serializable

    public class Pair
    extends Object
    implements Serializable
    A pair of a string key and a string value.

    java.util.AbstractMap.SimpleEntry class provides the same functionality in a more generic way, but the class is not available in Java SE 1.5.

    Since:
    1.39
    Author:
    Takahiko Kawasaki
    See Also:
    Serialized Form
    • Constructor Detail

      • Pair

        public Pair()
        Constructor with a null key and a null value.
      • Pair

        public Pair​(String key,
                    String value)
        Constructor with an initial key and an initial value.
        Parameters:
        key - The initial value of the key.
        value - The initial value of the value.
    • Method Detail

      • getKey

        public String getKey()
        Get the key of this pair.
        Returns:
        The key.
      • setKey

        public Pair setKey​(String key)
        Set the key of this pair.
        Parameters:
        key - The key.
        Returns:
        this object.
      • getValue

        public String getValue()
        Get the value of this pair.
        Returns:
        The value.
      • setValue

        public Pair setValue​(String value)
        Set the value of this pair.
        Parameters:
        value - The value.
        Returns:
        this object.