如何使用Triplet类构造Quartet
每个元组都有 add() 和 addAtX() 方法来转换元组。
package cn.xnip;
import org.javatuples.Quartet;
import org.javatuples.Triplet;
public class TupleTester {
public static void main(String args[]){
Triplet<Integer, Integer, Integer> triplet = Triplet.with(5,6,7);
System.out.println(triplet);
Quartet<Integer, Integer, Integer, String> quartet = triplet.add("test");
Quartet<String, Integer, Integer, Integer> quartet1 = triplet.addAt0("test");
System.out.println(quartet);
System.out.println(quartet1);
}
}
输出结果为: