code: @VisibleForTesting
      static Pair<List<SSTableReader>, Double> trimToThresholdWithHotness(List<SSTableReader> bucket, int maxThreshold)
      {
          // Sort by sstable hotness (descending). We first build a map because the hotness may change during the sort.
          final Map<SSTableReader, Double> hotnessSnapshot = getHotnessMap(bucket);
          Collections.sort(bucket, new Comparator<SSTableReader>()
          {
              public int compare(SSTableReader o1, SSTableReader o2)
              {
                  return -1 * Double.compare(hotnessSnapshot.get(o1), hotnessSnapshot.get(o2));
              }
          });
  
          // and then trim the coldest sstables off the end to meet the maxThreshold
          List<SSTableReader> prunedBucket = bucket.subList(0, Math.min(bucket.size(), maxThreshold));
  
          // bucket hotness is the sum of the hotness of all sstable members
          double bucketHotness = 0.0;
          for (SSTableReader sstr : prunedBucket)
              bucketHotness += hotness(sstr);
  
          return Pair.create(prunedBucket, bucketHotness);
      }
docs: Returns a (bucket, hotness) pair or null if there were not enough sstables in the bucket to meet minThreshold.
  If there are more than maxThreshold sstables, the coldest sstables will be trimmed to meet the threshold.