at.tuwien.ifs.commons.util.collection
Class Pair<S,T>
java.lang.Object
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
Constructor Summary |
Pair(S first,
T second)
|
first
private S first
second
private T second
Pair
public Pair(S first,
T second)
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)