我正在写这样的东西。TreeMap<Double, List<double[]>[]> tm = new TreeMap<>();在我的eclipse中好像不行,因为里面的代码init可以识别我想要的数据类型。总是有错误。我可以这样做吗?或者怎么做这种事情?
private static void init(TreeMap<Double, List<Double>[]> tm, List<double[]> ll) {
for(double[] a:ll) {
if(!tm.containsKey(a[0])) {
List[] ab= new List[2];
tm.put(new Double(a[0]),ab);
tm.get(a[0])[0] = new LinkedList<double[]>();
tm.get(a[0])[1] = new LinkedList<double[]>();
}
List<Double[]>[] b = tm.get(a[0]);
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
TreeMap<Double, List<double[]>[]> tm = new TreeMap<>();
List<double[]> ll = new LinkedList<>();
ll.add(new double[] {-3,2.2});
ll.add(new double[] {1,5.3});
ll.add(new double[] {-1.3,4});
ll.add(new double[] {8,22});
init(tm,ll);
}
有只小跳蛙
PIPIONE
相关分类