toArray() instead of array()

This commit is contained in:
Ben Fry
2022-08-03 21:10:23 -04:00
parent 0c7118f38e
commit 66e47f8fde
+14 -2
View File
@@ -734,22 +734,34 @@ public class DoubleList implements Iterable<Double> {
}
@Deprecated
public double[] array() {
return toArray();
}
/**
* Create a new array with a copy of all the values.
* @return an array sized by the length of the list with each of the values.
* @webref doublelist:method
* @brief Create a new array with a copy of all the values
*/
public double[] array() {
public double[] toArray() {
return array(null);
}
@Deprecated
public double[] array(double[] array) {
return toArray(array);
}
/**
* Copy values into the specified array. If the specified array is
* null or not the same size, a new array will be allocated.
*/
public double[] array(double[] array) {
public double[] toArray(double[] array) {
if (array == null || array.length != count) {
array = new double[count];
}