dk.brics.string.util
Class Pair<A,B>

java.lang.Object
  extended by dk.brics.string.util.Pair<A,B>

public final class Pair<A,B>
extends Object

A generic, immutable pair of two objects. Implements equals and hashCode.


Constructor Summary
Pair(A first, B second)
           
 
Method Summary
 boolean equals(Object obj)
           
 A getFirst()
           
 B getSecond()
           
 int hashCode()
           
static
<A,B> Pair<A,B>
make(A a, B b)
          Convenience method for creating a new pair, since generic arguments may be inferred by a static method call but not by a constructor call.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pair

public Pair(A first,
            B second)
Method Detail

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getFirst

public A getFirst()

getSecond

public B getSecond()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

make

public static <A,B> Pair<A,B> make(A a,
                                   B b)
Convenience method for creating a new pair, since generic arguments may be inferred by a static method call but not by a constructor call.



Copyright © 2003-2009 Anders Møller, Aske Simon Christensen, Asger Feldthaus.