docs: private VarOptItemsSketch<T> markMovingGadgetCoercer() {
      final int resultK = gadget_.getHRegionCount() + gadget_.getRRegionCount();
  
      int resultH = 0;
      int resultR = 0;
      int nextRPos = resultK; // = (resultK+1)-1, to fill R region from back to front
  
      final ArrayList<T> data         = new ArrayList<>(resultK + 1);
      final ArrayList<Double> weights = new ArrayList<>(resultK + 1);
  
      // Need arrays filled to use set() and be able to fill from end forward.
      // Ideally would create as arrays but trying to avoid forcing user to pass a Class<?>
      for (int i = 0; i < (resultK + 1); ++i) {
        data.add(null);
        weights.add(null);
      }
  
      final VarOptItemsSamples<T> sketchSamples = gadget_.getSketchSamples();
      // insert R region items, ignoring weights
      // Currently (May 2017) this next block is unreachable; this coercer is used only in the
      // pseudo-exact case in which case there are no items natively in R, only marked items in H
      // that will be moved into R as part of the coercion process.
      Iterator<VarOptItemsSamples<T>.WeightedSample> sketchIterator;
      sketchIterator = sketchSamples.getRIterator();
      while (sketchIterator.hasNext()) {
        final VarOptItemsSamples<T>.WeightedSample ws = sketchIterator.next();
        data.set(nextRPos, ws.getItem());
        weights.set(nextRPos, -1.0);
        ++resultR;
        --nextRPos;
      }
      double transferredWeight = 0;
  
      // insert H region items
      sketchIterator = sketchSamples.getHIterator();
      while (sketchIterator.hasNext()) {
        final VarOptItemsSamples<T>.WeightedSample ws = sketchIterator.next();
        if (ws.getMark()) {
          data.set(nextRPos, ws.getItem());
          weights.set(nextRPos, -1.0);
          transferredWeight += ws.getWeight();
          ++resultR;
          --nextRPos;
        } else {
          data.set(resultH, ws.getItem());
          weights.set(resultH, ws.getWeight());
          ++resultH;
        }
      }
  
      assert (resultH + resultR) == resultK;
      assert Math.abs(transferredWeight - outerTauNumer) < 1e-10;
  
      final double resultRWeight = gadget_.getTotalWtR() + transferredWeight;
      final long resultN = n_;
  
      // explicitly set values for the gap
      data.set(resultH, null);
      weights.set(resultH, -1.0);
  
      // create sketch with the new values
      return newInstanceFromUnionResult(data, weights, resultK, resultN, resultH, resultR, resultRWeight);
    }