Package org.checkerframework.javacutil
Class Pair<V1,V2>
java.lang.Object
org.checkerframework.javacutil.Pair<V1,V2>
- Type Parameters:
V1- the type of the first element of the pairV2- the type of the second element of the pair
Immutable pair class.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncloneElements(Pair<V1, V2> orig) Returns a copy of this in which each element is a clone of the corresponding element of this.static <V1 extends DeepCopyable<V1>,V2 extends DeepCopyable<V2>>
Pair<V1,V2> Returns a deep copy of this: each element is a deep copy (according to theDeepCopyableinterface) of the corresponding element of this.static <V1 extends DeepCopyable<V1>,V2>
Pair<V1,V2> deepCopyFirst(Pair<V1, V2> orig) Returns a copy, where thefirstelement is deep: thefirstelement is a deep copy (according to theDeepCopyableinterface), and the second element is identical to the argument.static <V1,V2 extends DeepCopyable<V2>>
Pair<V1,V2> deepCopySecond(Pair<V1, V2> orig) Returns a copy, where thesecondelement is deep: thefirstelement is identical to the argument, and the second element is a deep copy (according to theDeepCopyableinterface).booleaninthashCode()static <V1,V2> Pair<V1, V2> of(V1 v1, V2 v2) toString()
-
Field Details
-
first
The first element in the pair. -
second
The second element in the pair.
-
-
Method Details
-
of
-
cloneElements
public static <V1 extends Cloneable,V2 extends Cloneable> Pair<V1,V2> cloneElements(Pair<V1, V2> orig) Returns a copy of this in which each element is a clone of the corresponding element of this.clone()may or may not itself make a deep copy of the elements.- Type Parameters:
V1- the type of the first element of the pairV2- the type of the second element of the pair- Parameters:
orig- a pair- Returns:
- a copy of
orig, with all elements cloned
-
deepCopy
public static <V1 extends DeepCopyable<V1>,V2 extends DeepCopyable<V2>> Pair<V1,V2> deepCopy(Pair<V1, V2> orig) Returns a deep copy of this: each element is a deep copy (according to theDeepCopyableinterface) of the corresponding element of this.- Type Parameters:
V1- the type of the first element of the pairV2- the type of the second element of the pair- Parameters:
orig- a pair- Returns:
- a deep copy of
orig
-
deepCopyFirst
Returns a copy, where thefirstelement is deep: thefirstelement is a deep copy (according to theDeepCopyableinterface), and the second element is identical to the argument.- Type Parameters:
V1- the type of the first element of the pairV2- the type of the second element of the pair- Parameters:
orig- a pair- Returns:
- a copy of
orig, where the first element is a deep copy
-
deepCopySecond
Returns a copy, where thesecondelement is deep: thefirstelement is identical to the argument, and the second element is a deep copy (according to theDeepCopyableinterface).- Type Parameters:
V1- the type of the first element of the pairV2- the type of the second element of the pair- Parameters:
orig- a pair- Returns:
- a copy of
orig, where the second element is a deep copy
-
toString
-
hashCode
-
equals
-