A
- Class type for the first elementB
- Class type for the second elementC
- Class type for the third elementpublic class Triple<A,B,C> extends Object
A tuple consisting of three 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";
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,
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 triple.
|
B |
getSecond()
Returns the second element from this triple.
|
C |
getThird()
Returns the third element from this triple.
|
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> Triple<A,B,C> |
of(A a,
B b,
C c)
This factory allows a 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). |
static <A,B,C> Triple<A,B,C> |
unmodifiableOf(A a,
B b,
C c)
This factory allows an unmodifiable triple to be created using inference to obtain the generic types.
|
public boolean equals(Object o)
public A getFirst()
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> Triple<A,B,C> of(A a, B b, C c)
A
- Class type for the first elementB
- Class type for the second elementC
- Class type for the third elementa
- The first element, may be null
b
- The second element, may be null
c
- The third element, may be null
public void setFirst(A a)
a
- The first 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 triple using the format (first, second, third).public static <A,B,C> Triple<A,B,C> unmodifiableOf(A a, B b, C c)
A
- Class type for the first elementB
- Class type for the second elementC
- Class type for the third elementa
- The first element, may be null
b
- The second element, may be null
c
- The third element, may be null
Copyright © 2018. All rights reserved.