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
-
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 theDeepCopyable
interface) of the corresponding element of this.static <V1 extends DeepCopyable<V1>,
V2>
Pair<V1,V2> deepCopyFirst
(Pair<V1, V2> orig) Returns a copy, where thefirst
element is deep: thefirst
element is a deep copy (according to theDeepCopyable
interface), 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 thesecond
element is deep: thefirst
element is identical to the argument, and the second element is a deep copy (according to theDeepCopyable
interface).boolean
int
hashCode()
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 theDeepCopyable
interface) 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 thefirst
element is deep: thefirst
element is a deep copy (according to theDeepCopyable
interface), 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 thesecond
element is deep: thefirst
element is identical to the argument, and the second element is a deep copy (according to theDeepCopyable
interface).- 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
-