java.lang.Object
java.lang.Record
org.klojang.util.Tuple2<T,U>
- Type Parameters:
T
- The type of the first componentU
- The type of the second component- Record Components:
first
- The first component of the 2-tuplesecond
- The second component of the 2-tuple
Generic 2-tuple of arbitrarily typed, non-null objects.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.first()
Returns the value of thefirst
record component.final int
hashCode()
Returns a hash code value for this object.static <T,
U> Tuple2 <T, U> of
(T first, U second) Returns aTuple2
consisting of the specified components.second()
Returns the value of thesecond
record component.toEntry()
Converts this instance to an immutableMap
entry.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Tuple2
Instantiates a newTuple2
.- Parameters:
first
- The first component of the 2-tuplesecond
- The second component of the 2-tuple
-
-
Method Details
-
of
Returns aTuple2
consisting of the specified components.- Type Parameters:
T
- The type of the first componentU
- The type of the second component- Parameters:
first
- The first component of the 2-tuplesecond
- The second component of the 2-tuple- Returns:
- A
Tuple2
instance containing the specified values
-
toEntry
Converts this instance to an immutableMap
entry.- Returns:
- an immutable
Map
entry
-
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)
. -
first
Returns the value of thefirst
record component.- Returns:
- the value of the
first
record component
-
second
Returns the value of thesecond
record component.- Returns:
- the value of the
second
record component
-