Cleanup: use Java17' Records.

Fixes #1526.
This commit is contained in:
Dennis Guse
2023-06-07 23:02:56 +02:00
parent 81b090893b
commit d7022a07a2
34 changed files with 88 additions and 500 deletions
@@ -4,40 +4,13 @@ import androidx.annotation.NonNull;
import java.util.Objects;
public class Power {
public record Power(float value) {
public static Power of(float value) {
return new Power(value);
}
private final float value;
private Power(float value) {
this.value = value;
}
public float getW() {
return value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Power power = (Power) o;
return Float.compare(power.value, value) == 0;
}
@Override
public int hashCode() {
return Objects.hash(value);
}
@NonNull
@Override
public String toString() {
return "Power{" +
"value=" + value + " W" +
'}';
}
}