という があり、ArrayList
それout
を に変換する必要がありdouble[]
ます。私がオンラインで見つけた例は、次の 2 つのことを示しています。
初挑戦:
double[] d = new double[out.size()];
out.toArray(d);
ただし、これによりエラーが発生します (Eclipse):
The method toArray(T[]) in the type List<Double> is not applicable for the arguments (double[]).
私が見つけた2番目の解決策はStackOverflowで、次のとおりでした。
double[] dx = Arrays.copyOf(out.toArray(), out.toArray().length, double[].class);
ただし、これによりエラーが発生します。
The method copyOf(U[], int, Class<? extends T[]>) in the type Arrays is not applicable for the arguments (Object[], int, Class<double[]>)
out
これらのエラーの原因と、これらの問題を発生させずに変換するにはどうすればよいdouble[]
ですか? out
実際、 double 値のみを保持します。
ありがとう!