The essence: There is a class with int fields (from 1 to infinity). This class has a method that adds these values with another instance of this class. Question: Is it possible to do it somehow more elegantly? Code:
public class SomeClass {
int a = 0;
int b = 0;
int c = 0;
...
public void mergeValues(final SomeClass other) {
this.a += other.a;
this.b += other.b;
this.c += other.c;
.....
return this;
}
}```
Aucun commentaire:
Enregistrer un commentaire