public class Triple<A,B,C>
extends Object
A triple consisting of three elements. There is no restriction on the type of the objects that may be stored.
Example:
Map<String, Object> map = new HashMap<>();
map.put("parameter", "value");
Integer number = new Integer(3);
String string = "Test";
Triple<Map<String, Object>, Integer, String> data = new Triple<>(map, number, string);
Map<String, Object> myMap = data.getFirst();
Integer myNumber = data.getSecond();
String myString = data.getThird();| Constructor and Description |
|---|
Triple(A a,
B b,
C c)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
A |
getFirst()
Returns the first element from this triple.
|
B |
getSecond()
Returns the second element from this triple.
|
C |
getThird()
Returns the third element from this triple.
|
int |
hashCode() |
static <A,B,C> Triple<A,B,C> |
of(A a,
B b,
C c)
This factory allows the triple to be created using inference to obtain the generic types.
|
void |
setFirst(A a)
Sets the first element from this triple.
|
void |
setSecond(B b)
Sets the second element from this triple.
|
void |
setThird(C c)
Sets the third element from this triple.
|
String |
toString()
Returns a
String representation of this triple using the format (first, second, third). |
public A getFirst()
public B getSecond()
public C getThird()
public static <A,B,C> Triple<A,B,C> of(A a, B b, C c)
a - The first element, may be nullb - The second element, may be nullc - The third element, may be nullpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object o)
equals in class Objectpublic void setFirst(A a)
public void setSecond(B b)
public void setThird(C c)
public String toString()
String representation of this triple using the format (first, second, third).toString in class ObjectString representation of this triple