Class Tuple2<T>


  • public class Tuple2<T>
    extends java.lang.Object
    Very simple utility class which can hold any two objects of the same type in order.
    • Constructor Summary

      Constructors 
      Constructor Description
      Tuple2​(T valueA, T valueB)
      Constructs a Tuple2.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T firstValue()
      Returns the first value of the tuple.
      static <U> Tuple2<U> of​(U valueA, U valueB)
      Constructs and returns a Tuple2 of two values of the same data type.
      T secondValue()
      Returns the seond value of the tuple.
      java.util.List<T> toList()
      Returns the data of this object as a list of two elements.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • Tuple2

        public Tuple2​(T valueA,
                      T valueB)
        Constructs a Tuple2.
        Parameters:
        valueA - First value of T.
        valueB - Second value of T.
    • Method Detail

      • toList

        public java.util.List<T> toList()
        Returns the data of this object as a list of two elements.
        Returns:
        A list, containing two values, of the contents of this instance.
      • firstValue

        public T firstValue()
        Returns the first value of the tuple.
        Returns:
        An instance of T.
      • secondValue

        public T secondValue()
        Returns the seond value of the tuple.
        Returns:
        An instance of T.
      • of

        public static <U> Tuple2<U> of​(U valueA,
                                       U valueB)
        Constructs and returns a Tuple2 of two values of the same data type.
        Type Parameters:
        U - The data type of the values.
        Parameters:
        valueA - The first instance of U.
        valueB - The first instance of U.
        Returns:
        A Tuple2 of the two values.
      • toString

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