code: public double[] toArray() {
          double[] dense = new double[length()];
          for (IndexValue item : values) {
              dense[item.index] = item.value;
          }
          return dense;
      }
docs: {@inheritDoc}