Class Tuple<A,​B>

  • Type Parameters:
    A - first type
    B - second type

    public class Tuple<A,​B>
    extends java.lang.Object
    A Tuple holds two values of two different types.
    Since:
    5.3
    • Field Summary

      Fields 
      Modifier and Type Field Description
      A first  
      B second  
    • Constructor Summary

      Constructors 
      Constructor Description
      Tuple​(A first, B second)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <X,​Y>
      Tuple<X,​Y>
      create​(X first, Y second)  
      boolean equals​(java.lang.Object obj)
      Compares this Tuple to another object.
      protected void extendDescription​(java.lang.StringBuilder builder)
      Overriden in subclasses to write additional values into the description.
      int hashCode()
      Returns a hash code value for the tuple, based on its values.
      protected boolean isMatch​(java.lang.Object other)
      The heart of equals(Object); the other object is the same class as this object.
      java.lang.String toString()
      Returns the values of the tuple, separated by commas, enclosed in parenthesis.
      • Methods inherited from class java.lang.Object

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

      • Tuple

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

      • create

        public static <X,​Y> Tuple<X,​Y> create​(X first,
                                                          Y second)
      • toString

        public java.lang.String toString()
        Returns the values of the tuple, separated by commas, enclosed in parenthesis. Example: ("Ace", "Spades").
        Overrides:
        toString in class java.lang.Object
      • extendDescription

        protected void extendDescription​(java.lang.StringBuilder builder)
        Overriden in subclasses to write additional values into the description.
        Parameters:
        builder -
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares this Tuple to another object. Equality is defined by: other object is not null, is same class as this Tuple, and all values are themselves equal.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Returns a hash code value for the tuple, based on its values.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for this tuple.
        Since:
        5.7
      • isMatch

        protected boolean isMatch​(java.lang.Object other)
        The heart of equals(Object); the other object is the same class as this object.
        Parameters:
        other - other tuple to compare
        Returns:
        true if all values stored in tuple match