A - the class of the first object in the pairB - the class of the second object in the pairpublic class IndependentPair<A,B> extends Object
IndependentPair represents a generic pair of objects of different
(independent) types.| Constructor and Description |
|---|
IndependentPair(A obj1,
B obj2)
Constructs a Pair object with two objects obj1 and obj2
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object thatObject) |
A |
firstObject() |
static <T,Q> List<T> |
getFirst(Iterable<? extends IndependentPair<T,Q>> data)
Extract the first objects from a list of pairs.
|
static <T,Q> Function<IndependentPair<T,Q>,T> |
getFirstFunction()
Get the function that returns the first object from the pair
|
A |
getFirstObject() |
static <T,Q> List<Q> |
getSecond(Iterable<? extends IndependentPair<T,Q>> data)
Extract the second objects from a list of pairs.
|
static <T,Q> Function<IndependentPair<T,Q>,Q> |
getSecondFunction()
Get the function that returns the second object from the pair
|
B |
getSecondObject() |
static <T,Q> IndependentPair<T,Q> |
pair(T t,
Q q)
Create a pair from the given objects.
|
static <T,Q> List<IndependentPair<T,Q>> |
pairList(List<T> t,
List<Q> q)
Create a pair list from the given objects.
|
B |
secondObject() |
void |
setFirstObject(A obj)
Set first object in pair to obj
|
void |
setSecondObject(B obj)
Set second object in pair to obj
|
IndependentPair<B,A> |
swap()
Create a new
IndependentPair from this one with the elements
swapped |
static <T,Q> List<IndependentPair<? extends Q,? extends T>> |
swapList(List<? extends IndependentPair<? extends T,? extends Q>> data)
Swap the order of the pairs
|
String |
toString() |
public IndependentPair(A obj1, B obj2)
obj1 - first object in pairobj2 - second objec in pairpublic A firstObject()
public B secondObject()
public A getFirstObject()
public B getSecondObject()
public void setFirstObject(A obj)
obj - the objectpublic void setSecondObject(B obj)
obj - the objectpublic static <T,Q> IndependentPair<T,Q> pair(T t, Q q)
T - Type of first object.Q - Type of second object.t - The first object.q - The second object.public static <T,Q> List<T> getFirst(Iterable<? extends IndependentPair<T,Q>> data)
T - type of first objectQ - type of second objectdata - the datapublic static <T,Q> List<Q> getSecond(Iterable<? extends IndependentPair<T,Q>> data)
T - type of first objectQ - type of second objectdata - the datapublic static <T,Q> Function<IndependentPair<T,Q>,T> getFirstFunction()
public static <T,Q> Function<IndependentPair<T,Q>,Q> getSecondFunction()
public static <T,Q> List<IndependentPair<T,Q>> pairList(List<T> t, List<Q> q)
T - Type of objects.t - The list of first objects.q - The list of second objects.public IndependentPair<B,A> swap()
IndependentPair from this one with the elements
swappedpublic static <T,Q> List<IndependentPair<? extends Q,? extends T>> swapList(List<? extends IndependentPair<? extends T,? extends Q>> data)
data - the input