mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-21 14:37:45 +07:00
GitOrigin-RevId: 17887007325fda8f9128274bf0d28ce70b5d8c0b
39 lines
825 B
Java
39 lines
825 B
Java
import java.util.Objects;// "Convert record to class" "true-preview"
|
|
public final class Point {
|
|
private final int x;
|
|
private final int y;
|
|
|
|
public Point(int x, int y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
public int x() {
|
|
return x;
|
|
}
|
|
|
|
public int y() {
|
|
return y;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object obj) {
|
|
if (obj == this) return true;
|
|
if (obj == null || obj.getClass() != this.getClass()) return false;
|
|
Point that = (Point) obj;
|
|
return this.x == that.x &&
|
|
this.y == that.y;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(x, y);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "Point[" +
|
|
"x=" + x + ", " +
|
|
"y=" + y + ']';
|
|
}
|
|
} |