public class Pair<T, S> { private T first; private S second; //etc (more code follows) }
public Pair(T aFirst, S aSecond) {
this.first = aFirst;
this.second = aSecond;
}
public T getFirst() {
return this.first;
}
public S getSecond() {
return this.second;
}
public void setFirst(T newFirst) {
this.first = newFirst;
}
public void setSecond(S newSecond) {
this.second = newSecond;
}
package pair.model; public class Pair<T, S> { private T first; private S second; //-------------------------- //Constructors Here public Pair(T aFirst, S aSecond) { this.first = aFirst; this.second = aSecond; } //-------------------------- //Accessors public T getFirst() { return this.first; } public S getSecond() { return this.second; } public void setFirst(T newFirst) { this.first = newFirst; } public void setSecond(S newSecond) { this.second = newSecond; } //-------------------------- //Services @Override public String toString() { return getFirst().toString() + " -- " + getSecond().toString(); } }