class ModuloBucketBuilder implements MultiBucketBuilder {

    private final int numBuckets;
    private final List<StreamBucket.Builder> bucketBuilders;
    private final int distributedByColumnIdx;
    private int size = 0;

    public ModuloBucketBuilder(Streamer<?>[] streamers, int numBuckets, int distributedByColumnIdx, RamAccounting ramAccounting) {
        this.numBuckets = numBuckets;
        this.distributedByColumnIdx = distributedByColumnIdx;
        this.bucketBuilders = new ArrayList<>(numBuckets);
        for (int i = 0; i < numBuckets; i++) {
            bucketBuilders.add(new StreamBucket.Builder(streamers, ramAccounting));
        }
    }

    @Override
    public void add(Row row) {
        StreamBucket.Builder builder = bucketBuilders.get(getBucket(row));
        builder.add(row);
        size++;
    }

    @Override
    public int size() {
        return size;
    }

    @Override
    public void build(StreamBucket[] buckets) {
        assert buckets.length == numBuckets : "length of the provided array must match numBuckets";
        for (int i = 0; i < numBuckets; i++) {
            StreamBucket.Builder builder = bucketBuilders.get(i);
            buckets[i] = builder.build();
            builder.reset();
        }
        size = 0;
    }

    /**
     * get bucket number by doing modulo hashcode of the defined row-element
     */
    private int getBucket(Row row) {
        int hash = hashCode(row.get(distributedByColumnIdx));
        if (hash == Integer.MIN_VALUE) {
            hash = 0; // Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE
        }
        return Math.abs(hash) % numBuckets;
    }

    private static int hashCode(@Nullable Object value) {<FILL_FUNCTION_BODY>}

    @Override
    public long ramBytesUsed() {
        long sum = 0;
        for (int i = 0; i < bucketBuilders.size(); i++) {
            sum += bucketBuilders.get(i).ramBytesUsed();
        }
        return sum;
    }
}

        if (value == null) {
            return 0;
        }
        return value.hashCode();
    
<no_super_class>