public class Quadruple<A,B,C,D>
extends Object
An immutable quadruple consisting of four 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";
List list = new ArrayList();
Quadruple<Map<String, Object>, Integer, String, List> data = new Quadruple<>(map, number, string, list);
Map<String, Object> myMap = data.getFirst();
Integer myNumber = data.getSecond();
String myString = data.getThird();
List myList = data.getFourth();
Constructor and Description |
---|
Quadruple(A a,
B b,
C c,
D d)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
A |
getFirst()
Returns the first element from this quadruple.
|
D |
getFourth()
Returns the fourth element from this quadruple.
|
B |
getSecond()
Returns the second element from this quadruple.
|
C |
getThird()
Returns the third element from this quadruple.
|
int |
hashCode() |
static <A,B,C,D> Quadruple<A,B,C,D> |
of(A a,
B b,
C c,
D d)
This factory allows the quadruple to be created using inference to obtain the generic types.
|
String |
toString()
Returns a
String representation of this quadruple using the format (first, second, third, fourth). |
public A getFirst()
public B getSecond()
public C getThird()
public D getFourth()
public static <A,B,C,D> Quadruple<A,B,C,D> of(A a, B b, C c, D d)
a
- The first element, may be null
b
- The second element, may be null
c
- The third element, may be null
d
- The fourth element, may be null
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
String
representation of this quadruple using the format (first, second, third, fourth).toString
in class Object
String
representation of this quadruple