docs: @SuppressWarnings("unchecked")
    Result getSamplesAsArrays(final Class<?> clazz) {
      if ((r_ + h_) == 0) {
        return null;
      }
  
      // are Array.asList(data_.subList()) copies better?
      final int numSamples = getNumSamples();
      final T[] prunedItems = (T[]) Array.newInstance(clazz, numSamples);
      final double[] prunedWeights = new double[numSamples];
      int j = 0;
      final double rWeight = totalWtR_ / r_;
      for (int i = 0; j < numSamples; ++i) {
        final T item = data_.get(i);
        if (item != null) {
          prunedItems[j] = item;
          prunedWeights[j] = (weights_.get(i) > 0 ? weights_.get(i) : rWeight);
          ++j;
        }
      }
  
      final Result output = new Result();
      output.items = prunedItems;
      output.weights = prunedWeights;
  
      return output;
    }