protected static List<Block> mergeBlocks(final List<Block> blocks,
                                             final List<PartitioningMath.Partition> partitions,
                                             final Set<LinkDigest> survivors) {
        final List<Block> merged = new ArrayList<Block>();
        for (PartitioningMath.Partition partition : partitions) {
            if (partition.getStart() == partition.getEnd()) {
                merged.add(blocks.get(partition.getStart()));
                continue;
            }
            final ArrayList<LinkDigest> digests = new ArrayList<LinkDigest>();
            for (int index = partition.getStart(); index <= partition.getEnd(); index++) {
                digests.addAll(blocks.get(index).getDigests());
            }

            List<LinkDigest> filtered = new ArrayList<LinkDigest>();
            for (LinkDigest digest : digests) {
                if (!survivors.contains(digest)) {
                    //System.out.println("DROPPED: " + digest);
                    continue;
                }
                filtered.add(digest);
                survivors.remove(digest); // i.e. no duplicates.
            }
            merged.add(new Block(filtered));
        }

        return merged;
    }