2026-08-08 04:46 UTC
Valhalla has arrived in mainline Java (build 28-ea+10-569): https://jdk.java.net/28/
$ cat Points.java
value record Point(double x, double y) {
public Point moveBy(double dx, double dy) {
return new Point(x + dx, y + dy);
}
}
void main() {
var p = new Point(0, 0);
for (int i = 0; i < 100_000_000; i++) {
p = p.moveBy(Math.random() - 0.5, Math.random() - 0.5);
}
IO.println(p);
}
$ java --enable-preview Points.java
Replies (0)
No replies.