private boolean fillDownsampledReadsCache() {
    while (nestedSAMIterator.hasNext() && !downsampler.hasFinalizedItems()) {
      downsampler.submit(nestedSAMIterator.next());
    }

    if (!nestedSAMIterator.hasNext()) {
      downsampler.signalEndOfInput();
    }

    // use returned collection directly rather than make a copy, for speed
    downsampledReadsCache = downsampler.consumeFinalizedItems();
    downsampledReadsCacheIterator = downsampledReadsCache.iterator();

    return downsampledReadsCacheIterator.hasNext();
  }
 public void close() {
   nestedSAMIterator.close();
 }