docs: public static <A> double[] toPrimitiveDoubleArray(A array, NumberArrayAdapter<?, ? super A> adapter) {
      if (adapter == DOUBLEARRAYADAPTER) {
        return ((double[]) array).clone();
      }
      double[] ret = new double[adapter.size(array)];
      for (int i = 0; i < ret.length; i++) {
        ret[i] = adapter.getDouble(array, i);
      }
      return ret;
    }