Package ffx.utilities
Record Class ObjectPair<T,S extends Comparable<S>>
java.lang.Object
java.lang.Record
ffx.utilities.ObjectPair<T,S>
- Type Parameters:
T
- The class of the non-comparable object.S
- The class of the indexing, comparable object.- Record Components:
val
- The non-comparable object.key
- The indexing, comparable object.
- All Implemented Interfaces:
Comparable<ObjectPair<T,
S>>
public record ObjectPair<T,S extends Comparable<S>> (T val, S extends Comparable<S> key)
extends Record
implements Comparable<ObjectPair<T,S>>
ObjectPair record.
Implements a comparable pair, where a non-comparable T can be compared via a comparable S.
- Since:
- 1.0
- Author:
- Jacob Litman
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(ObjectPair<T, S> o) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.key()
Returns the value of thekey
record component.static <U,
V extends Comparable<V>>
List<U> sortAndReturn
(List<ObjectPair<U, V>> theList) sortAndReturn.final String
toString()
Returns a string representation of this record class.val()
Returns the value of theval
record component.
-
Constructor Details
-
Method Details
-
sortAndReturn
sortAndReturn. -
compareTo
- Specified by:
compareTo
in interfaceComparable<T>
-
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)
. -
val
Returns the value of theval
record component.- Returns:
- the value of the
val
record component
-
key
Returns the value of thekey
record component.- Returns:
- the value of the
key
record component
-