Class Pair<K1,​K2>

  • Type Parameters:
    K1 -
    K2 -

    public class Pair<K1,​K2>
    extends Object
    This is a simple class to store a pair of objects.
    • Constructor Detail

      • Pair

        public Pair​(K1 k1,
                    K2 k2)
        Creates a new pair using the two keys provided.
        Parameters:
        k1 -
        k2 -
      • Pair

        public Pair​(K1 k1,
                    K2 k2,
                    Pair.PairEqualsMode equalsMode)
        Creates a new pair using the two keys provided.
        Parameters:
        k1 -
        k2 -
    • Method Detail

      • newPair

        public static <K1,​K2> Pair<K1,​K2> newPair​(K1 k1,
                                                              K2 k2)
        static factory method
        Type Parameters:
        K1 -
        K2 -
        Parameters:
        k1 -
        k2 -
        Returns:
      • newPair

        public static <K1,​K2> Pair<K1,​K2> newPair​(K1 k1,
                                                              K2 k2,
                                                              Pair.PairEqualsMode equalsMode)
        static factory method
        Type Parameters:
        K1 -
        K2 -
        Parameters:
        k1 -
        k2 -
        Returns:
      • getK1

        public K1 getK1()
        Returns:
        the first key
      • getK2

        public K2 getK2()
        Returns:
        the second key
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object