net.sourceforge.xconf.toolbox.generic
Class Pair<L,R>

java.lang.Object
  extended by net.sourceforge.xconf.toolbox.generic.Pair<L,R>
All Implemented Interfaces:
Serializable, Comparable<Pair<L,R>>

public class Pair<L,R>
extends Object
implements Comparable<Pair<L,R>>, Serializable

Generic holder class for when you absolutely need to return more than one object from a method, or when you need to use more than one object as a map key or collection entry.

Author:
Tom Czarniecki
See Also:
Serialized Form

Constructor Summary
Pair()
           
Pair(L left, R right)
           
 
Method Summary
 int compareTo(Pair<L,R> other)
           
static
<L,R> Pair<L,R>
create(L left, R right)
           
 boolean equals(Object obj)
           
 L getLeft()
           
 R getRight()
           
 int hashCode()
           
 void setLeft(L left)
           
 void setRight(R right)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair()

Pair

public Pair(L left,
            R right)
Method Detail

create

public static <L,R> Pair<L,R> create(L left,
                                     R right)

getLeft

public L getLeft()

setLeft

public void setLeft(L left)

getRight

public R getRight()

setRight

public void setRight(R right)

compareTo

public int compareTo(Pair<L,R> other)
Specified by:
compareTo in interface Comparable<Pair<L,R>>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007 Thomas Czarniecki. All Rights Reserved.