@Override
    double[] toArray() {
      int size = getSize();
      double[] result = new double[size];
      for (int i = 0; i < result.length; i++) result[i] = get(i);
      return result;
    }
@Override
    double[] toArray()