なんとなくJavaでTupleを実装してみた
まったく大したことじゃない。ただなんとなくw
// 要素2個のTuple public class Tuple<T1, T2> { public T1 val1; public T2 val2; public Tuple(T1 value1, T2 value2) { this.val1 = value1; this.val2 = value2; } } public class Test { public static void main(String args[]) { Tuple<String, Integer> tuple = new Tuple<String, Integer>("omiend", 32); System.out.println("■ " + tuple.val1); System.out.println("■ " + tuple.val2); } } // ■ omiend // ■ 32
じゃばのバージョンは1.7