モダンなJavaコードスニペットのコレクション。古いパターンとその洗練されたモダンな置き換えを並べて比較。
public class Point {
private final int x, y;
public Point(int x, int y) { ... }
public int getX() { return x; }
public int getY() { return y; }
// equals, hashCode, toString
}
public record Point(int x, int y) {}