org.clazzes.util.lang
Class Pair<A,B>

java.lang.Object
  extended by org.clazzes.util.lang.Pair<A,B>
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ComparablePair

public class Pair<A,B>
extends java.lang.Object
implements java.io.Serializable

Author:
wglas A pair of two java objects, implemented as a Java 1.5 generic. The lack of this type is actually a bug of JRE 1.5
See Also:
Serialized Form

Constructor Summary
Pair()
          Contructs a pair holding two null values.
Pair(A a, B b)
          Contructs a pair holding the given objects.
Pair(Pair<A,B> p)
          Contructs a pair holding the objects of the given pair.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 A getFirst()
           
 B getSecond()
           
 int hashCode()
           
 void setFirst(A first)
           
 void setSecond(B second)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pair

public Pair()
Contructs a pair holding two null values.


Pair

public Pair(A a,
            B b)
Contructs a pair holding the given objects.


Pair

public Pair(Pair<A,B> p)
Contructs a pair holding the objects of the given pair.

Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getFirst

public A getFirst()
Returns:
Returns the first object.

setFirst

public void setFirst(A first)
Parameters:
first - The first object to set.

getSecond

public B getSecond()
Returns:
Returns the second object.

setSecond

public void setSecond(B second)
Parameters:
second - The second objet to set.


Copyright © 2010. All Rights Reserved.