A - the first value typeB - the second value type@Externalize(value=Pair.Externalizer.class) public final class Pair<A,B> extends java.lang.Object implements java.io.Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
Pair.Externalizer
An externalizer for
Pair instances. |
| Modifier and Type | Field and Description |
|---|---|
private A |
a |
private B |
b |
private int |
hashCode |
private static long |
serialVersionUID |
private static FieldSetter |
setter |
| Modifier and Type | Method and Description |
|---|---|
static <A,B> Pair<A,B> |
create(A a,
B b)
Create a new instance.
|
boolean |
equals(java.lang.Object other)
Determine if this pair equals another.
|
boolean |
equals(Pair<?,?> other)
Determine if this pair equals another.
|
A |
getA()
Get the first value.
|
B |
getB()
Get the second value.
|
int |
hashCode()
Return the combined hash code of the two argument objects.
|
private static int |
hashCode(java.lang.Object a,
java.lang.Object b)
Calculate the combined hash code of two objects.
|
private void |
readObject(java.io.ObjectInputStream ois)
Reinitialize the object and set the hash code.
|
java.lang.String |
toString()
Get a string representation of this pair.
|
private static final long serialVersionUID
private final A a
private final B b
private final transient int hashCode
private static final FieldSetter setter
private static int hashCode(java.lang.Object a,
java.lang.Object b)
a - the first objectb - the second objectpublic A getA()
public B getB()
private void readObject(java.io.ObjectInputStream ois)
throws java.io.IOException,
java.lang.ClassNotFoundException
ois - the object input streamjava.io.IOException - if an I/O error occurs while reading the default fieldsjava.lang.ClassNotFoundException - if a class isn't found while reading the default fieldspublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectother - the other pairtrue if they are equal, false otherwisepublic boolean equals(Pair<?,?> other)
other - the other pairtrue if they are equal, false otherwisepublic java.lang.String toString()
toString in class java.lang.Objectpublic static <A,B> Pair<A,B> create(A a, B b)
A - the first value typeB - the second value typea - the first valueb - the second value