Package org.apache.spark.util
Record Class Pair<L,R>
An immutable pair of values. Note that the fields are intentionally designed to be `getLeft` and
`getRight` instead of `left` and `right` in order to mitigate the migration burden
from `org.apache.commons.lang3.tuple.Pair`.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.getLeft()
Returns the value of thegetLeft
record component.getRight()
Returns the value of thegetRight
record component.final int
hashCode()
Returns a hash code value for this object.static <L,
R> Pair<L, R> of
(L left, R right) final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Pair
Creates an instance of aPair
record class.- Parameters:
getLeft
- the value for thegetLeft
record componentgetRight
- the value for thegetRight
record component
-
-
Method Details
-
of
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
getLeft
Returns the value of thegetLeft
record component.- Returns:
- the value of the
getLeft
record component
-
getRight
Returns the value of thegetRight
record component.- Returns:
- the value of the
getRight
record component
-