JIDE 3.5.15

com.jidesoft.chart.util
Class Pair<T,U>

java.lang.Object
  extended by com.jidesoft.chart.util.Pair<T,U>
Type Parameters:
T - the type of the first element of the pair
U - the type of the second element of the pair

public class Pair<T,U>
extends Object

A generic class that contains a pair of two objects of types T and U. This class is useful when you want to bind two objects together without the overhead of creating a custom class. Note that you can use wild-cards when creating Pairs: Pair<? extends Number, ? extends Number> p = new Pair<Integer, Integer>(1, 2);

Author:
swhite@catalysoft.com

Constructor Summary
Pair()
          Creates a Pair in which both elements are null
Pair(T first, U second)
          Creates a Pair using the supplied first and second parameters as the values for the first and second properties, respectively.
 
Method Summary
 T getFirst()
          Retrieve the first element of the pair
 U getSecond()
          Retrieve the second element of the pair
 void setFirst(T first)
          Specify the first element of the pair
 void setSecond(U second)
          Specify the second element of the pair
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair()
Creates a Pair in which both elements are null


Pair

public Pair(T first,
            U second)
Creates a Pair using the supplied first and second parameters as the values for the first and second properties, respectively.

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

setFirst

public void setFirst(T first)
Specify the first element of the pair

Parameters:
first - the first element of the pair

setSecond

public void setSecond(U second)
Specify the second element of the pair

Parameters:
second - the second element of the pair

getFirst

public T getFirst()
Retrieve the first element of the pair

Returns:
the first element of the pair

getSecond

public U getSecond()
Retrieve the second element of the pair

Returns:
the second element of the pair

toString

public String toString()
Overrides:
toString in class Object

JIDE 3.5.15