Slide 17
Slide 17 text
3FDPSEɺγʔϧ
17
sealed interface UserAction permits Click, Drag, Scroll {}
record Click(int x, int y) implements UserAction {}
record Drag(int startX, int startY,
int endX, int endY) implements UserAction {}
record Scroll(int amount) implements UserAction {}
Recordでクラス定義の
ボイラープレートを減らせる
(getter, equals,
hashCode, toString)
パターンの網羅性を担保、
defaultを省略できる