Class Tuple2<T>

java.lang.Object
org.chsrobotics.lib.util.Tuple2<T>
Type Parameters:
T - The data type of objects to store.

public class Tuple2<T> extends 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

    Modifier and Type
    Method
    Description
    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.
    Returns the seond value of the tuple.
    Returns the data of this object as a list of two elements.
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Tuple2

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

    • toList

      public 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 String toString()
      Overrides:
      toString in class Object