Class Pair<T1,T2>
java.lang.Object
com.saperion.common.lang.encapsulation.Pair<T1,T2>
- Type Parameters:
T1
- type of first objectT2
- type of second object
- All Implemented Interfaces:
Serializable
A simple immutable encapsulation for 2 objects.
An instance of this Pair
can be used in several threads concurrently.
- Author:
- agz
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Pair
Creates a newPair
with the specified first and second objects. Both objects may benull
.- Parameters:
first
- first objectsecond
- second object
-
-
Method Details
-
getFirst
Returns the first object.- Returns:
- first object
-
getSecond
Returns the second object.- Returns:
- second object
-
equals
-
hashCode
public int hashCode() -
toString
-
newInstance
Convenience factory method for letting the compiler do the type inference.- Parameters:
first
- The first object in the pairsecond
- The second object in the pair- Returns:
- A pair consisting of the given objects
-