A - Class type for the first elementB - Class type for the second elementC - Class type for the third elementD - Class type for the fourth elementpublic class Quadruple<A,B,C,D>
extends Object
A tuple consisting of four elements. There is no restriction on the type of the objects that may be stored.
Example:
Map<String, Object> map = new LinkedHashMap<>();
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,
boolean isModifiable)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one.
|
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()
Returns a hash code value for the object.
|
boolean |
isModifiable()
Indicates whether or not elements from the pair can be changed after initialization.
|
static <A,B,C,D> Quadruple<A,B,C,D> |
of(A a,
B b,
C c,
D d)
This factory allows a quadruple to be created using inference to obtain the generic types.
|
void |
setFirst(A a)
Sets the first element from this quadruple.
|
void |
setFourth(D d)
Sets the fourth element from this quadruple.
|
void |
setSecond(B b)
Sets the second element from this quadruple.
|
void |
setThird(C c)
Sets the third element from this quadruple.
|
String |
toString()
Returns a
String representation of this quadruple using the format (first, second, third, fourth). |
static <A,B,C,D> Quadruple<A,B,C,D> |
unmodifiableOf(A a,
B b,
C c,
D d)
This factory allows an unmodifiable pair to be created using inference to obtain the generic types.
|
public Quadruple(A a, B b, C c, D d, boolean isModifiable)
a - The first element, may be nullb - The second element, may be nullc - The third element, may be nulld - The fourth element, may be nullisModifiable - Indicates whether or not the elements can be changed after initializationpublic boolean equals(Object o)
equals in class Objecto - Reference object with which to comparetrue if this object is the same as the o argument; false otherwisepublic A getFirst()
public D getFourth()
public B getSecond()
public C getThird()
public int hashCode()
HashMap.hashCode in class Objectpublic boolean isModifiable()
true if the element can be changed. Otherwise, falsepublic static <A,B,C,D> Quadruple<A,B,C,D> of(A a, B b, C c, D d)
A - Class type for the first elementB - Class type for the second elementC - Class type for the third elementD - Class type for the fourth elementa - The first element, may be nullb - The second element, may be nullc - The third element, may be nulld - The fourth element, may be nullpublic void setFirst(A a)
a - The first element, may be nullpublic void setFourth(D d)
d - The fourth element, may be nullpublic void setSecond(B b)
b - The second element, may be nullpublic void setThird(C c)
c - The third element, may be nullpublic String toString()
String representation of this quadruple using the format (first, second, third, fourth).toString in class ObjectString representation of this quadruplepublic static <A,B,C,D> Quadruple<A,B,C,D> unmodifiableOf(A a, B b, C c, D d)
A - Class type for the first elementB - Class type for the second elementC - Class type for the third elementD - Class type for the fourth elementa - The first element, may be nullb - The second element, may be nullc - The third element, may be nulld - The fourth element, may be null