jfun.util
Class Pair

java.lang.Object
  extended by jfun.util.Pair
All Implemented Interfaces:
java.io.Serializable

public final class Pair
extends java.lang.Object
implements java.io.Serializable

Represents a immutable pair of objects.

Author:
Ben Yu Jan 16, 2005
See Also:
Serialized Form

Constructor Summary
Pair(java.lang.Object f, java.lang.Object s)
          Create a pair.
 
Method Summary
 java.lang.Object fst()
          get the first object in the pair.
 Pair setFst(java.lang.Object f)
          Functional update.
 Pair setSnd(java.lang.Object s)
          Functional update.
 java.lang.Object snd()
          Get the second object in the pair.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair(java.lang.Object f,
            java.lang.Object s)
Create a pair.

Parameters:
f - the first object.
s - the second object.
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

fst

public java.lang.Object fst()
get the first object in the pair.

Returns:
the first object.

snd

public java.lang.Object snd()
Get the second object in the pair.

Returns:
the second object.

setFst

public Pair setFst(java.lang.Object f)
Functional update. Create a new Pair object with the first object set to f.

Parameters:
f - the new value of the first object.
Returns:
the new Pair object.

setSnd

public Pair setSnd(java.lang.Object s)
Functional update. Create a new Pair object with the second object set to f.

Parameters:
s - the new value of the second object.
Returns:
the new Pair object.