Class Pair<S,​U>

  • Type Parameters:
    S - type of the first value
    U - type of the second value
    All Implemented Interfaces:
    Serializable

    public class Pair<S,​U>
    extends Object
    implements Serializable
    A convenience data structure encapsulating 2 values. This class can be used to return two values from a method call and create compound keys/values in other collections.
    Since:
    1.5.4 com.github.kilianB, 1.5.6 implements serializable com.github.kilianB
    Author:
    Kilian
    See Also:
    Serialized Form
    • Constructor Detail

      • Pair

        public Pair​(S first,
                    U second)
        Parameters:
        first - element of the pair
        second - element of the pair
      • Pair

        public Pair​(Pair<? extends S,​? extends U> original)
        Copy constructor.

        Creates a copy of the supplied entry. This is a soft clone referencing the same instances of the original pair.

        Parameters:
        original - the original pair to take the entries from.
    • Method Detail

      • getFirst

        public S getFirst()
        Returns:
        the first object stored in this pair
      • getSecond

        public U getSecond()
        Returns:
        the second object stored in this pair
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object