Class Tuple<T>


  • public final class Tuple<T>
    extends Object
    Container for three values of the same type: a "red" one, a "blue" one, and a shallow copy of the "red" one.
    • Constructor Detail

      • Tuple

        public Tuple​(T red,
                     T blue,
                     T redCopy)
        Constructor.
        Parameters:
        red - The red value.
        blue - The blue value.
        redCopy - A shallow copy of the red value.
    • Method Detail

      • of

        public static <U> Tuple<U> of​(Object red,
                                      Object blue,
                                      Object redCopy)
        Factory method that turns three untyped values into a typed tuple.
        Type Parameters:
        U - The assumed type of the values.
        Parameters:
        red - The red value.
        blue - The blue value.
        redCopy - A shallow copy of the red value.
        Returns:
        A typed tuple with the three given values.
      • getRed

        public T getRed()
        Returns:
        The red value.
      • getBlue

        public T getBlue()
        Returns:
        The blue value.
      • getRedCopy

        public T getRedCopy()
        Returns:
        The shallow copy of the red value.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object