code: private synchronized List<TableBucket> toBuckets(List<Map.Entry<UUID, Long>> indexHashes) {
          val buckets = new ArrayList<TableBucket>();
          if (indexHashes == null) {
              // Nothing more in the index. Add whatever is in the cache attributes.
              while (!this.cacheHashes.isEmpty()) {
                  add(this.cacheHashes.removeFirst(), buckets);
              }
  
              return buckets.isEmpty() ? null : buckets;
          } else {
              // Transform every eligible Attribute into a TableBucket and add it to the result.
              for (val indexHash : indexHashes) {
                  if (KeyHasher.isValid(indexHash.getKey()) && indexHash.getValue() != Attributes.NULL_ATTRIBUTE_VALUE) {
                      // For each bucket returned above, include all Buckets/hashes from the ContainerKeyIndex which are equal to or
                      // below it. (this is very similar to the AttributeMixer - maybe reuse that methodology).
                      boolean overridden = false;
                      while (!this.cacheHashes.isEmpty()) {
                          val cacheHash = this.cacheHashes.peekFirst();
                          int cmp = indexHash.getKey().compareTo(this.cacheHashes.peekFirst().getKey());
                          if (cmp < 0) {
                              // Cache Hash is after Index Hash. We are done here.
                              break;
                          }
  
                          // The value we got from the Index was overridden by the one in the cache.
                          overridden = overridden || cmp == 0;
                          add(cacheHash, buckets);
                          this.cacheHashes.removeFirst();
                      }
  
                      if (!overridden) {
                          add(indexHash, buckets);
                      }
                  }
              }
          }
  
          return buckets;
      }
docs: Merges the given list of Index Hashes with the available Cache Hashes and generates the associated {@link TableBucket}s.