更新时间:2023-02-26 22:18:52
这是因为 List
由 double []
而不是 double $ c组成$ c>。
因为 double []
是一个数组,你必须指定该数组的位置同样。像这样:
Because a double[]
is an array, you have to specify the position from that array as well. Like so:
x.get(0)[0]
如果你想能够只使用 x.get()
,你的 List
必须由 double
原语组成。然后你可以使用一个单独的方法将 double
的数组添加到 List
(我不知道那个内置):
If you want to be able to just use x.get()
, your List
must be made up of double
primitives. Then you can add the array of doubles
to the List
using a separate method (I don't know of one that is built in):
List<Double> addArray(List<Double> o, double[] a) {
for(Double d : a)
o.add(d);
return o;
}
希望这是有道理的。我喜欢使用短变量名来使逻辑更清晰。只要你知道变量是什么,你应该没问题。
Hopefully that makes sense. I like using short variable names to make the logic more clear. As long as you know what the variables are, you should be fine.