public class PairArray implements Pair {
private S[] elems;
@SuppressWarnings(“unchecked”)
public PairArray(S first, S second) {
elems = (S[]) new Object[2];
elems[0] = first;
elems[1] = second;
}
public S getFirst() {
return elems[0];
}
public S getSecond() {
return elems[1];
}
public void setFirst(S value) {
elems[0] = value;
}
public void setSecond(S value) {
elems[1]= value;
}
}