Package org.drasyl.util
Class Triple<A,B,C>
- java.lang.Object
-
- org.drasyl.util.Triple<A,B,C>
-
- All Implemented Interfaces:
Serializable
public class Triple<A,B,C> extends Object implements Serializable
A tuple of three elements.Inspired by: https://github.com/javatuples/javatuples/blob/master/src/main/java/org/javatuples/Triplet.java
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
A
first()
int
hashCode()
static <A,B,C>
Triple<A,B,C>of(A first, B second, C third)
Obtains a tuple of three elements inferring the generic types.B
second()
C
third()
String
toString()
-
-
-
Method Detail
-
first
public A first()
- Returns:
- the first element
-
second
public B second()
- Returns:
- the second element
-
third
public C third()
- Returns:
- the third element
-
of
public static <A,B,C> Triple<A,B,C> of(A first, B second, C third)
Obtains a tuple of three elements inferring the generic types.
This factory allows the triple to be created using inference to obtain the generic types.
- Type Parameters:
A
- the first element typeB
- the second element typeC
- the third element type- Parameters:
first
- the first element, may be nullsecond
- the second element, may be nullthird
- the third element, may be null- Returns:
- a triple formed from the three parameters, not null
-
-