public class Triple<T1, T2, T3> {
private T1 o1;
private T2 o2;
private T3 o3;
public Triple(T1 o1, T2 o2, T3 o3) {
this.o1 = o1;
this.o2 = o2;
this.o3 = o3;
}
public void setO1(T1 o1) {
this.o1 = o1;
}
public T1 getO1() {
return o1;
}
public void setO2(T2 o2) {
this.o2 = o2;
}
public T2 getO2() {
return o2;
}
public void setO3(T3 o3) {
this.o3 = o3;
}
public T3 getO3() {
return o3;
}
}
Пример:
List<Triple<String, Integer, String>> list
= new ArrayList<Triple<String, Integer, String>>();
list.add(new Triple("tr1", 1, "Triple 1"));
list.add(new Triple("tr2", 2, "Triple 2"));
list.add(new Triple("tr3", 3, "Triple 3"));