Package org.chsrobotics.lib.util
Class Tuple2<T>
- java.lang.Object
-
- org.chsrobotics.lib.util.Tuple2<T>
-
public class Tuple2<T> extends java.lang.ObjectVery simple utility class which can hold any two objects of the same type in order.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TfirstValue()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.TsecondValue()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.StringtoString()
-
-
-
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:
toStringin classjava.lang.Object
-
-