Package jasima.core.util
Class Pair<A,B>
- java.lang.Object
-
- jasima.core.util.Pair<A,B>
-
- Type Parameters:
A- Type of the first element.B- Type of the second element.
- All Implemented Interfaces:
Serializable,Cloneable
public class Pair<A,B> extends Object implements Cloneable, Serializable
Simple wrapper to store two different objects. Instances of this class are immutable.This class can be used safely with
nullvalues for a and b.- Author:
- Torsten Hildebrandt
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Pair<A,B>clone()booleanequals(Object obj)Afirst()inthashCode()static <A,B>
Pair<A,B>of(A a, B b)Convenient factory method calling the constructorPair(Object, Object).Bsecond()StringtoString()Returns a String containing a and b separated by comma and enclosed in arrow brackets.
-
-
-
Method Detail
-
first
public A first()
-
second
public B second()
-
toString
public String toString()
Returns a String containing a and b separated by comma and enclosed in arrow brackets.
-
clone
public Pair<A,B> clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
of
public static <A,B> Pair<A,B> of(A a, B b)
Convenient factory method calling the constructorPair(Object, Object).
-
-