|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--util.Pair
A utility container that represents a pair of Serializable objects o1 and o2 such that pair( o1, o2 ) == [ o1, o2 ].
Cloneable
,
Comparable
,
Serializable
,
Speakable
, Serialized FormField Summary | |
protected Serializable |
sObj1
The first object |
protected Serializable |
sObj2
The second object |
Constructor Summary | |
Pair()
Creates a new Pair instance with null as both objects. |
|
Pair(Serializable s1,
Serializable s2)
Creates a new Pair instance. |
Method Summary | |
int |
compareTo(Object oObj)
Compares this object with the specified object for order. |
boolean |
equals(Object oObj)
Returns true if this object is equal to the given object. |
Serializable |
first()
Returns the first object. |
int |
hashCode()
Returns a hash code value for the object. |
Serializable |
second()
Returns the second object. |
Serializable |
setFirst(Serializable sNew)
Sets the first serializable object in this pair to a given value. |
Serializable |
setSecond(Serializable sNew)
Sets the second serializable object in this pair to a given value. |
void |
swap()
Swaps the two serializable objects in this pair, such that [ o1, o2 ] becomes [ o2, o1 ] for all possible values of o1 and o2. |
String |
toSpeech()
Returns a speakable string representation of this. |
String |
toString()
Returns a string representation of this. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Serializable sObj1
protected Serializable sObj2
Constructor Detail |
public Pair()
Pair
instance with null as both objects.public Pair(Serializable s1, Serializable s2)
Pair
instance.s1
- a Serializable
values2
- a Serializable
valueMethod Detail |
public Serializable first()
Serializable
valuepublic Serializable second()
Serializable
valuepublic String toString()
toString
in class Object
String
valuepublic String toSpeech()
toSpeech
in interface Speakable
String
valuepublic boolean equals(Object oObj)
equals
in class Object
oObj
- an Object
valueboolean
valuepublic int hashCode()
java.util.Hashtable
.hashCode
in class Object
int
valuepublic int compareTo(Object oObj)
compareTo
in interface Comparable
oObj
- an Object
valueint
valuepublic Serializable setFirst(Serializable sNew)
sNew
- a Serializable
valueSerializable
value of the previous first value.public Serializable setSecond(Serializable sNew)
sNew
- a Serializable
valueSerializable
value of the previous second value.public void swap()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |