private List<Long> pruneBucket(List<Long> bucketList,double pruneFactor){
  int pruneStartIndex=0;
  int startSize=bucketList.size();
  int i=0;
  while (pruneStartIndex < bucketList.size()) {
    if (i == 0) {
      pruneStartIndex=(int)(startSize * pruneFactor) + pruneStartIndex;
    }
    i++;
    int numToPrune=i * i * 32;
    logger.debug("Pruning " + numToPrune + " buckets at position: "+ pruneStartIndex+ ", bucket list is currently: "+ bucketList.size()+ " long.");
    List<Long> newBucketList=bucketList.subList(0,pruneStartIndex);
    int endPrune=pruneStartIndex + numToPrune;
    if (endPrune > bucketList.size()) {
      newBucketList.add(bucketList.get(bucketList.size() - 1));
      pruneStartIndex=bucketList.size();
    }
 else {
      newBucketList.addAll(bucketList.subList(pruneStartIndex + numToPrune,bucketList.size()));
    }
    bucketList=newBucketList;
    pruneStartIndex++;
  }
  int numRecordsPruned=startSize - bucketList.size();
  double percentPruned=((double)numRecordsPruned / (double)startSize) * 100d;
  logger.debug("Pruned " + numRecordsPruned + " buckets out of "+ startSize+ " for a percent of "+ percentPruned);
  return bucketList;
}

private List < Long > pruneBucket ( List < Long > bucketList , double pruneFactor ) { int pruneStartIndex = 0 ; int startSize = bucketList . size ( ) ; int i = 0 ; while ( pruneStartIndex < bucketList . size ( ) ) { if ( i == 0 ) { pruneStartIndex = ( int ) ( startSize * pruneFactor ) + pruneStartIndex ; } i ++ ; int numToPrune = i * i * 32 ; logger . debug ( "Pruning " + numToPrune + " buckets at position: " + pruneStartIndex + ", bucket list is currently: " + bucketList . size ( ) + " long." ) ; List < Long > newBucketList = bucketList . subList ( 0 , pruneStartIndex ) ; int endPrune = pruneStartIndex + numToPrune ; if ( endPrune > bucketList . size ( ) ) { newBucketList . add ( bucketList . get ( bucketList . size ( ) - 1 ) ) ; pruneStartIndex = bucketList . size ( ) ; } else { newBucketList . addAll ( bucketList . subList ( pruneStartIndex + numToPrune , bucketList . size ( ) ) ) ; } bucketList = newBucketList ; pruneStartIndex ++ ; } int numRecordsPruned = startSize - bucketList . size ( ) ; double percentPruned = ( ( double ) numRecordsPruned / ( double ) startSize ) * 100d ; logger . debug ( "Pruned " + numRecordsPruned + " buckets out of " + startSize + " for a percent of " + percentPruned ) ; return bucketList ; }
prunes our buckets from the end of the bucket list . once a pruning start position is established , it prunes chunks of the bucket list based on bucketpruninginteration ^ 2 * 32 .
