java中将数据三元组存储在列表中的最佳方法是什么?
[a, b, c]
[a, b, c]
...
我通常使用 HashMap 来存储一对数据键 + 值。我应该使用 HashMap + Arraylist 吗?或 ArrayList + ArrayList ?
thanks
public class Triplet<T, U, V> {
private final T first;
private final U second;
private final V third;
public Triplet(T first, U second, V third) {
this.first = first;
this.second = second;
this.third = third;
}
public T getFirst() { return first; }
public U getSecond() { return second; }
public V getThird() { return third; }
}
并实例化列表:
List<Triplet<String, Integer, Integer>> = new ArrayList<>();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)