at.tuwien.ifs.commons.util.collection
Class Pair<S,T>

java.lang.Object
  extended by at.tuwien.ifs.commons.util.collection.Pair<S,T>
Direct Known Subclasses:
Triple

public class Pair<S,T>
extends Object

A class that holds two typed objects together; mostly useful to return multiple values from a method, without having to make a dedicated class, or using an untyped collection or array that would require casting the contents in the calling method.

Version:
$Id: Pair.java 4264 2012-04-03 14:50:18Z mayer $
Author:
Rudolf Mayer

Field Summary
private  S first
           
private  T second
           
 
Constructor Summary
Pair(S first, T second)
           
 
Method Summary
 boolean equals(Object obj)
           
 S getFirst()
           
 T getSecond()
           
 int hashCode()
           
 void setFirst(S first)
           
 void setSecond(T second)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

first

private S first

second

private T second
Constructor Detail

Pair

public Pair(S first,
            T second)
Method Detail

getFirst

public S getFirst()
Returns:
Returns the first element.

getSecond

public T getSecond()
Returns:
Returns the second element.

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

setFirst

public void setFirst(S first)

setSecond

public void setSecond(T second)