NumberLibrary { public static int sumInts(Iterable<Integer> values) { int total = 0; for (Integer value : values) { total += value; } return total; }  static Function<String, Integer> methodParseInteger(); static int ifNegative(int number, int ifNegative); static int ifLessThan(int bound, int number, int ifLess); static int ifGreaterThan(int bound, int number, int ifGreater); static int bounded(int min, int max, int target); static int sumInts(Iterable<Integer> values); static long sumLongs(Iterable<Long> values); static double sum(Iterable<? extends Number> values); static double mean(Collection<? extends Number> values); static double median(Collection<? extends T> values);  }
@Test public void sumOfIntegersOfACollection() { Collection<Integer> empty = asList(); assertTrue(0 == sumInts(empty)); assertTrue(10 == sumInts(asList(1,2,3,4))); assertTrue(-10 == sumInts(asList(-1,-2,-3,-4))); }