[ 
https://issues.apache.org/jira/browse/FLINK-37665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

dalongliu reassigned FLINK-37665:
---------------------------------

    Assignee: Atul Sharma

> Simplify DoubleMaximum.clone() Implementation
> ---------------------------------------------
>
>                 Key: FLINK-37665
>                 URL: https://issues.apache.org/jira/browse/FLINK-37665
>             Project: Flink
>          Issue Type: Improvement
>            Reporter: Atul Sharma
>            Assignee: Atul Sharma
>            Priority: Minor
>              Labels: pull-request-available
>
> 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 message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to