class NonNegativeIntegerSplitterByWeights {

    public static <R, C> ImmutableTable<R, C, Integer> splitByIntegerTableWeights(
            ImmutableTable<R, C, Integer> weights,
            int numberToSplit) {

        ImmutableMap<Cell<R, C, Integer>, Integer> weightMap = weights.cellSet().stream()
                .collect(ImmutableMap.toImmutableMap(
                        Function.identity(),
                        Cell::getValue));

        ImmutableMap<Cell<R, C, Integer>, Integer> split =
                NonNegativeIntegerSplitterByWeights.createFromInts(weightMap).split(numberToSplit);

        return split.keySet().stream()
                .collect(ImmutableTable.toImmutableTable(
                        Cell::getRowKey,
                        Cell::getColumnKey,
                        split::get));
    }

    public  NonNegativeIntegerSplitterByWeights(ImmutableMap<E, Double> weights);

}