Firefish 0.5.10

gov.lbl.dsd.util
Class Pair

java.lang.Object
  extended bygov.lbl.dsd.util.Pair
All Implemented Interfaces:
Serializable

public class Pair
extends Object
implements Serializable

A convenience class holding two elements, namely first and second, either or both of which may be null.

See Also:
Serialized Form

Constructor Summary
Pair(Object first, Object second)
          Constructs a pair with the given two elements, either or both of which may be null.
 
Method Summary
 boolean equals(Object other)
           
static boolean equals(Object xA, Object yA, Object xB, Object yB)
          Compares two 'pairs' x and y for equality.
 Object first()
          Returns the first element of the pair.
 int hashCode()
           
static int hashCode(Object x, Object y)
          Returns the hashcode of the two elements of a 'pair'.
 Object second()
          Returns the second element of the pair.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair(Object first,
            Object second)
Constructs a pair with the given two elements, either or both of which may be null.

Parameters:
first - the first element of the pair.
second - the second element of the pair.
Method Detail

first

public Object first()
Returns the first element of the pair.

Returns:
The first element of the pair.

second

public Object second()
Returns the second element of the pair.

Returns:
The second element of the pair.

toString

public String toString()

hashCode

public int hashCode()

equals

public boolean equals(Object other)

equals

public static boolean equals(Object xA,
                             Object yA,
                             Object xB,
                             Object yB)
Compares two 'pairs' x and y for equality. In other words determines xA.equals(yA) and xB.equals(yB), taking care of null values. This is a static method that avoids the inefficiency of temporary Pair objects.

Returns:
true if the pair x and the pair y are equal; false otherwise.

hashCode

public static int hashCode(Object x,
                           Object y)
Returns the hashcode of the two elements of a 'pair'. This is a static method that avoids the inefficiency of temporary Pair objects.

Returns:
the hash code.

Firefish 0.5.10

Jump to the Firefish Homepage