atu-sharm opened a new pull request, #26449:
URL: https://github.com/apache/flink/pull/26449
The current implementation of the clone() method in the DoubleMaximum class
uses the default constructor and manually sets the max field:
{code:java}
// Some comments here
@Override
public DoubleMaximum clone() {
DoubleMaximum clone = new DoubleMaximum();
clone.max = this.max;
return clone;
}
{code}
This can be simplified by directly using the existing constructor
DoubleMaximum(double value) to initialize the cloned object. The proposed
change is:
{code:java}
@Override
public DoubleMaximum clone() {
return new DoubleMaximum(this.max);
}
{code}
Benefits of the Change:
Conciseness: The new implementation is shorter and avoids redundant code.
Encapsulation: It ensures the object is fully initialized in one step using
the constructor.
Readability: The new implementation is easier to read and maintain.
This change improves the maintainability and clarity of the code without
altering its functionality.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]