RangeUtil { public static <T, V extends AdditiveValue<V>, R> void overlapSum( List<R> x, List<? extends List<R>> y, RangeHome<T, V, R> rangeHome, V sum) { for (List<R> yElement : y) { sum.add(rangeHome.overlap(x, yElement)); } }  static void overlapSum(
    List<R> x, List<? extends List<R>> y, RangeHome<T, V, R> rangeHome, V sum); static List<R> toOrthotope(
    List<Pow2LengthBitSetRange> pow2LengthOrthotope, RangeHome<T, V, R> rangeHome); static boolean contains(List<R> orthotope, List<T> point); static boolean containsBigInteger(List<BigIntegerRange> orthotope, List<BigInteger> point); static boolean contains(int[][] orthotope, int[] point);  }
@Test public void overlapSum() { LongRange x0 = LongRange.of(100, 105); LongRange x1 = LongRange.of(103, 200); LongRange y0 = LongRange.of(1, 10); LongRange y1 = LongRange.of(0, 5); List<List<LongRange>> list = Lists.newArrayList(); List<LongRange> x0y0 = ImmutableList.of(x0, y0); list.add(x0y0); list.add(x0y0); List<LongRange> x1y1 = ImmutableList.of(x1, y1); list.add(x1y1); LongContent actual = new LongContent(0); RangeUtil.overlapSum(x0y0, list, LongRangeHome.INSTANCE, actual); Assert.assertEquals(8 + ((x0.getEnd() - x0.getStart()) * (y0.getEnd() - y0.getStart()) << 1), actual.value()); }