Class Pair<L,​R>

  • Type Parameters:
    L - the type for the left element in the pair
    R - the type for the right element in the pair

    @ThreadSafe
    public class Pair<L,​R>
    extends java.lang.Object
    A generic pair of elements.
    Author:
    Jeremy Long
    • Constructor Summary

      Constructors 
      Constructor Description
      Pair()
      Constructs a new empty pair.
      Pair​(L left, R right)
      Constructs a new Pair with the given left and right values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Determines the equality of this and the provided object.
      L getLeft()
      Get the value of left.
      R getRight()
      Get the value of right.
      int hashCode()
      Generates the hash code using the hash codes from the contained objects.
      void setLeft​(L left)
      Set the value of left.
      void setRight​(R right)
      Set the value of right.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Pair

        public Pair()
        Constructs a new empty pair.
      • Pair

        public Pair​(L left,
                    R right)
        Constructs a new Pair with the given left and right values.
        Parameters:
        left - the value for the left pair
        right - the value for the right pair
    • Method Detail

      • getLeft

        public L getLeft()
        Get the value of left.
        Returns:
        the value of left
      • setLeft

        public void setLeft​(L left)
        Set the value of left.
        Parameters:
        left - new value of left
      • getRight

        public R getRight()
        Get the value of right.
        Returns:
        the value of right
      • setRight

        public void setRight​(R right)
        Set the value of right.
        Parameters:
        right - new value of right
      • hashCode

        public int hashCode()
        Generates the hash code using the hash codes from the contained objects.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash code of the Pair
      • equals

        public boolean equals​(java.lang.Object obj)
        Determines the equality of this and the provided object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the Object to check for equality to this
        Returns:
        true if this and the provided Object are equal; otherwise false