コード内で繰り返される例外スロー コードを最小限に抑えるにはどうすればよいですか。
public R get(int index) throws IndexException {
if (!((0 <= index) && (index < this.info.length))) {
throw new IndexException();
}
return this.info[index];
}
public void set(int index, R r) throws IndexException {
if (!((0 <= index) && (index < this.info.length))) {
throw new IndexException();
}
this.info[index] = r;
}