Package com.ontology2.pidove.util
Record Class Pair<X,Y>
java.lang.Object
java.lang.Record
com.ontology2.pidove.util.Pair<X,Y>
- Type Parameters:
X
- type of first valueY
- type of second value- Record Components:
left
- first valueright
- second value
- All Implemented Interfaces:
Tuple<X,
Y>
Tuple of length 2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionand
(Z right) Adds a third value to make this a Trio.final boolean
Indicates whether some other object is "equal to" this one.first()
final int
hashCode()
Returns a hash code value for this object.last()
left()
Returns the value of theleft
record component.static <X,
Y> Pair<X, Y> of
(X l, Y r) static factory methodreverse()
right()
Returns the value of theright
record component.int
size()
final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
of
static factory method- Type Parameters:
X
- type of first valueY
- type of second value- Parameters:
l
- first valuer
- second value- Returns:
- new pair
-
and
Adds a third value to make this a Trio. The current right value becomes the middle- Type Parameters:
Z
- type of the new value- Parameters:
right
- new value- Returns:
- a Trio where the first two values come from here and the third value is the one passed in
-
reverse
- Returns:
- a new pair with the left and right values switched
-
size
public int size() -
first
-
last
-
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)
. -
left
Returns the value of theleft
record component.- Returns:
- the value of the
left
record component
-
right
Returns the value of theright
record component.- Returns:
- the value of the
right
record component
-