Package org.pgcodekeeper.core.utils
Class Pair<K,V>
java.lang.Object
org.pgcodekeeper.core.utils.Pair<K,V>
- Type Parameters:
K- type of the first elementV- type of the second element
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ModPair
Immutable pair utility class for holding two related objects.
Objects of this class are unmodifiable.
Use
ModPair and copyMod() to get modifiable Pairs.- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Pair
Creates a new immutable pair with specified elements.- Parameters:
first- the first elementsecond- the second element
-
-
Method Details
-
getFirst
Returns the first element of this pair.- Returns:
- the first element
-
getSecond
Returns the second element of this pair.- Returns:
- the second element
-
hashCode
public int hashCode() -
equals
-
toString
-
copy
Creates an immutable copy of this pair.- Returns:
- new immutable Pair with same elements
-
copyMod
Creates a modifiable copy of this pair.- Returns:
- new ModPair with same elements
-