Class Pair<A>

  • Type Parameters:
    A - the type of the items being stored

    public class Pair<A>
    extends java.lang.Object
    An ordered pair storing two items of type A
    • Constructor Summary

      Constructors 
      Constructor Description
      Pair​(A first, A second)
      Creates a pair with two given items
    • Method Summary

      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      A getFirst()
      Gets the first item from the pair
      A getSecond()
      Gets the second item from the pair
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • Pair

        public Pair​(A first,
                    A second)
        Creates a pair with two given items
        Parameters:
        first - the first item in the pair
        second - the second item in the pair
    • Method Detail

      • getFirst

        public A getFirst()
        Gets the first item from the pair
        Returns:
        the first item from the pair
      • getSecond

        public A getSecond()
        Gets the second item from the pair
        Returns:
        the second item from the pair
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object