Class Pair<A,​B>

  • Type Parameters:
    A - the type of the first value in the pair
    B - the type of the second value in the pair
    All Implemented Interfaces:
    Serializable

    public class Pair<A,​B>
    extends Object
    implements Serializable
    A simple generic class representing a pair of values.
    Since:
    4.0
    Author:
    Anindya Chatterjee.
    See Also:
    Serialized Form
    • Constructor Detail

      • Pair

        public Pair()
      • Pair

        public Pair​(A first,
                    B second)
    • Method Detail

      • pair

        public static <A,​B> Pair<A,​B> pair​(A first,
                                                       B second)
        Creates a new pair.
        Type Parameters:
        A - the type parameter
        B - the type parameter
        Parameters:
        first - the first
        second - the second
        Returns:
        the pair
      • getFirst

        public A getFirst()
      • getSecond

        public B getSecond()
      • setFirst

        public void setFirst​(A first)
      • setSecond

        public void setSecond​(B second)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object