defensive-copy
์๋ฏธ
์ทจ์ฝ์
public final class Period {
private final Date start;
private final Date end;
public Period(Date start, Date end) {
if (start.compareTo(end) > 0) {
throw new IllegalArgumentException("start๊ฐ end๋ณด๋ค ๋ฆ์ผ๋ฉด ์๋๋ค");
}
this.start = start;
this.end = end;
}
public Date getStart() { return start; }
public Date getEnd() { return end; }์ฌ์ฉํ๋ ์ด์
ํด๊ฒฐ ๋ฐฉ๋ฒ
์ฐธ๊ณ
Last updated