A
- Class type for the first elementB
- Class type for the second elementC
- Class type for the third elementD
- Class type for the fourth elementE
- Class type for the fifth elementpublic class Quintuple<A,B,C,D,E> extends Object
A tuple consisting of five 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();
Set set = new LinkedHashSet();
Quintuple<Map<String, Object>, Integer, String, List, Set> data = new Quintuple<>(map, number, string, list, set);
Map<String, Object> myMap = data.getFirst();
Integer myNumber = data.getSecond();
String myString = data.getThird();
List myList = data.getFourth();
Set mySet = data.getFifth();
Constructor and Description |
---|
Quintuple(A a,
B b,
C c,
D d,
E e,
boolean isModifiable)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one.
|
E |
getFifth()
Returns the fifth element from this tuple.
|
A |
getFirst()
Returns the first element from this quintuple.
|
D |
getFourth()
Returns the fourth element from this quintuple.
|
B |
getSecond()
Returns the second element from this quintuple.
|
C |
getThird()
Returns the third element from this quintuple.
|
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,E> |
of(A a,
B b,
C c,
D d,
E e)
This factory allows a quintuple to be created using inference to obtain the generic types.
|
void |
setFifth(E e)
Sets the fifth element from this quintuple.
|
void |
setFirst(A a)
Sets the first element from this quintuple.
|
void |
setFourth(D d)
Sets the fourth element from this quintuple.
|
void |
setSecond(B b)
Sets the second element from this quintuple.
|
void |
setThird(C c)
Sets the third element from this quintuple.
|
String |
toString()
Returns a
String representation of this quintuple using the format (first, second, third, fourth, fifth). |
static <A,B,C,D,E> |
unmodifiableOf(A a,
B b,
C c,
D d,
E e)
This factory allows an unmodifiable quintuple to be created using inference to obtain the generic types.
|
public Quintuple(A a, B b, C c, D d, E e, boolean isModifiable)
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
e
- The fifth element, may be null
isModifiable
- Indicates whether or not the elements can be changed after initializationpublic boolean equals(Object o)
public E getFifth()
public A getFirst()
public D getFourth()
public B getSecond()
public C getThird()
public int hashCode()
HashMap
.public boolean isModifiable()
true
if the element can be changed. Otherwise, false
public static <A,B,C,D,E> Quintuple<A,B,C,D,E> of(A a, B b, C c, D d, E e)
A
- Class type for the first elementB
- Class type for the second elementC
- Class type for the third elementD
- Class type for the fourth elementE
- Class type for the fifth elementa
- 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
e
- The fifth element, may be null
public void setFifth(E e)
e
- The fifth element, may be null
public void setFirst(A a)
a
- The first element, may be null
public void setFourth(D d)
d
- The fourth element, may be null
public void setSecond(B b)
b
- The second element, may be null
public void setThird(C c)
c
- The third element, may be null
public String toString()
String
representation of this quintuple using the format (first, second, third, fourth, fifth).public static <A,B,C,D,E> Quintuple<A,B,C,D,E> unmodifiableOf(A a, B b, C c, D d, E e)
A
- Class type for the first elementB
- Class type for the second elementC
- Class type for the third elementD
- Class type for the fourth elementE
- Class type for the fifth elementa
- 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
e
- The fifth element, may be null
Copyright © 2018. All rights reserved.