Package eu.cloudnetservice.common.tuple
Record Class Tuple2<F,S>
java.lang.Object
java.lang.Record
eu.cloudnetservice.common.tuple.Tuple2<F,S>
- Type Parameters:
F- the first element type.S- the second element type.- Record Components:
first- the first value of the tuple.second- the second value of the tuple.
A pair consisting of two elements: the first and second one. Both of these elements are allowed to be null. While the
tuple implementation itself is immutable, there is no restriction if a type stored in a pair is immutable or not. If
mutable values are stored in a pair the pair itself effectively becomes mutable.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @UnknownNullability FThe field for thefirstrecord component.private final @UnknownNullability SThe field for thesecondrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionTuple2(@UnknownNullability F first, @UnknownNullability S second) Creates an instance of aTuple2record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.first()Returns the value of thefirstrecord component.final inthashCode()Returns a hash code value for this object.second()Returns the value of thesecondrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
Constructor Details
-
Method Details
-
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 thefirstrecord component.- Returns:
- the value of the
firstrecord component
-
second
Returns the value of thesecondrecord component.- Returns:
- the value of the
secondrecord component
-