Record Class RecordPatternsExamples.Rectangle
java.lang.Object
java.lang.Record
net.jrodolfo.java_evolution.java21.RecordPatternsExamples.Rectangle
- Record Components:
topLeft- top-left pointbottomRight- bottom-right point
- Enclosing class:
RecordPatternsExamples
public static record RecordPatternsExamples.Rectangle(RecordPatternsExamples.Point topLeft, RecordPatternsExamples.Point bottomRight)
extends Record
Rectangle record made of two points.
-
Constructor Summary
ConstructorsConstructorDescriptionRectangle(RecordPatternsExamples.Point topLeft, RecordPatternsExamples.Point bottomRight) Creates an instance of aRectanglerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebottomRightrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.topLeft()Returns the value of thetopLeftrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Rectangle
Creates an instance of aRectanglerecord class.- Parameters:
topLeft- the value for thetopLeftrecord componentbottomRight- the value for thebottomRightrecord component
-
-
Method Details
-
toString
-
hashCode
-
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). -
topLeft
-
bottomRight
Returns the value of thebottomRightrecord component.- Returns:
- the value of the
bottomRightrecord component
-