private static Sizes combine(
            final Sizes s1,
            final Sizes s2,
            final BiFunction<Long, Long, Long> function) {

        if (s1 == null) {
            return s2;
        } else if (s2 == null) {
            return s1;
        }

        final int length = Math.max(s1.sizes.length, s2.sizes.length);
        final long[] combinedSizes = new long[length];
        for (int i = 0; i < combinedSizes.length; i++) {
            final long v1 = s1.size(i);
            final long v2 = s2.size(i);
            combinedSizes[i] = function.apply(v1, v2);
        }
        final long combinedDefaultSize = function.apply(s1.defaultSize, s2.defaultSize);
        return new Sizes(combinedSizes, combinedDefaultSize);
    }
Create a set of sizes based on a list of longs. Where a size is not provided for a requested depth the
supplied default size will be used.

@param list        The list of sizes to use.
@param defaultSize The default size to return if needed.
@return A new set of sizes.
stroom-query/stroom-query-common/src/main/java/stroom/query/common/v2/Sizes.java