java.lang.Object
java.lang.Record
org.tquadrat.foundation.lang.Pair<L,R> 
- Type Parameters:
 L- The type for the left value.R- The type for the right value.- Record Components:
 left- The left value of the pair.right- The right value of the pair.
@ClassVersion(sourceVersion="$Id: Pair.java 1119 2024-03-16 09:03:57Z tquadrat $")
@API(status=STABLE,
     since="0.1.0")
public record Pair<L,R> (L left, R right)
extends Record
The implementation of a tupel.
Both values are allowed to be null.
- Author:
 - Thomas Thrien (thomas.thrien@tquadrat.org)
 - Version:
 - $Id: Pair.java 1119 2024-03-16 09:03:57Z tquadrat $
 - Since:
 - 0.1.0
 - UML Diagram
 - 
    
        
UML Diagram for "org.tquadrat.foundation.lang.Pair"
 
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionasEntry()Returns this instance ofPairas an instance ofMap.Entry.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.left()Returns the value of theleftrecord component.Creates a new instance ofPairwith the right value from this one and the given new left value.right()Returns the value of therightrecord component.Creates a new instance ofPairwith the left value from this one and the given new right value.final StringtoString()Returns a string representation of this record class. 
- 
Field Details
 - 
Constructor Details
 - 
Method Details
- 
asEntry
Returns this instance of
Pairas an instance ofMap.Entry. The left value is thekey, the right value is thevalue.The method
Map.Entry.setValue(Object)is not implemented and will throw an exception when called.- Returns:
 - A reference to this instance as an 
Entry. 
 - 
left
Creates a new instance ofPairwith the right value from this one and the given new left value.- Parameters:
 newLeft- The new left value; can benull.- Returns:
 - A new instance of 
Pair. 
 - 
right
Creates a new instance ofPairwith the left value from this one and the given new right value.- Parameters:
 newRight- The new right value; can benull.- Returns:
 - A new instance of 
Pair. 
 - 
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
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 theleftrecord component.- Returns:
 - the value of the 
leftrecord component 
 - 
right
Returns the value of therightrecord component.- Returns:
 - the value of the 
rightrecord component 
 
 - 
 
