FirstType - The type of the first object in the triple.SecondType - The type of second object in the triple.ThirdType - The type of the third object in the triple.public class DefaultTriple<FirstType,SecondType,ThirdType> extends AbstractCloneableSerializable implements Triple<FirstType,SecondType,ThirdType>
DefaultTriple class implements a simple structure for a triple
of three objects, potentially of different types.| Modifier and Type | Field and Description |
|---|---|
protected FirstType |
first
The first object.
|
protected SecondType |
second
The second object.
|
protected ThirdType |
third
The third type.
|
| Constructor and Description |
|---|
DefaultTriple()
Creates a new instance of
DefaultTriple with initial null values. |
DefaultTriple(FirstType first,
SecondType second,
ThirdType third)
Creates a new instance of
DefaultTriple. |
| Modifier and Type | Method and Description |
|---|---|
DefaultTriple<FirstType,SecondType,ThirdType> |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
FirstType |
getFirst()
Gets the first object.
|
SecondType |
getSecond()
Gets the second object.
|
ThirdType |
getThird()
Gets the third object.
|
static <FirstType,SecondType,ThirdType> |
mergeCollections(java.util.Collection<FirstType> firsts,
java.util.Collection<SecondType> seconds,
java.util.Collection<ThirdType> thirds)
Takes three collections of data of the same size and creates a new single
ArrayList<DefaultTriple> out of their elements. |
void |
setFirst(FirstType first)
Sets the first object.
|
void |
setSecond(SecondType second)
Sets the second object.
|
void |
setThird(ThirdType third)
Sets the third object.
|
protected FirstType first
protected SecondType second
protected ThirdType third
public DefaultTriple()
DefaultTriple with initial null values.public DefaultTriple(FirstType first, SecondType second, ThirdType third)
DefaultTriple.first - The first object.second - The second object.third - The third object.public DefaultTriple<FirstType,SecondType,ThirdType> clone()
AbstractCloneableSerializableObject class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone() to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone() as the basis for your implementation.clone in interface CloneableSerializableclone in class AbstractCloneableSerializablepublic FirstType getFirst()
TriplegetFirst in interface Triple<FirstType,SecondType,ThirdType>public void setFirst(FirstType first)
first - The new value for the first object.public SecondType getSecond()
TriplegetSecond in interface Triple<FirstType,SecondType,ThirdType>public void setSecond(SecondType second)
second - The new value for the second object.public ThirdType getThird()
TriplegetThird in interface Triple<FirstType,SecondType,ThirdType>public void setThird(ThirdType third)
third - The new value for the third object.public static <FirstType,SecondType,ThirdType> java.util.ArrayList<DefaultTriple<FirstType,SecondType,ThirdType>> mergeCollections(java.util.Collection<FirstType> firsts, java.util.Collection<SecondType> seconds, java.util.Collection<ThirdType> thirds)
ArrayList<DefaultTriple> out of their elements.FirstType - The type of the first element.SecondType - The type of the second element.ThirdType - The type of the third element.firsts - A collection of data to transform into the first
element of the triple. Must have the same size as seconds and
thirds.seconds - A collection of data to transform into the second
element of the triple. Must have the same size as firsts and
thirds.thirds - A collection of data to transform into the third
element of the triple. Must have the same size as firsts and
seconds.