@Test public void shouldReturnAnAccumulatorThatAddsTheSuppliedIntegerInputToTheSuppliedAccumulatorValue() throws Exception { Reducer<Integer, Integer> integerAdditionAccumulator = Accumulators.integerAdditionAccumulator(); Integer result = integerAdditionAccumulator.accumulate(10, 5); assertThat(result, is(15)); }
public static Reducer<Integer, Integer> integerAdditionAccumulator() { return new Reducer<Integer, Integer>() { @Override public Integer accumulate(Integer accumulator, Integer element) { return accumulator + element; } }; }
Accumulators { public static Reducer<Integer, Integer> integerAdditionAccumulator() { return new Reducer<Integer, Integer>() { @Override public Integer accumulate(Integer accumulator, Integer element) { return accumulator + element; } }; } }
Accumulators { public static Reducer<Integer, Integer> integerAdditionAccumulator() { return new Reducer<Integer, Integer>() { @Override public Integer accumulate(Integer accumulator, Integer element) { return accumulator + element; } }; } private  Accumulators(); }
Accumulators { public static Reducer<Integer, Integer> integerAdditionAccumulator() { return new Reducer<Integer, Integer>() { @Override public Integer accumulate(Integer accumulator, Integer element) { return accumulator + element; } }; } private  Accumulators(); static Reducer<Integer, Integer> integerAdditionAccumulator(); static Reducer<Long, Long> longAdditionAccumulator(); static Reducer<Double, Double> doubleAdditionAccumulator(); static Reducer<Float, Float> floatAdditionAccumulator(); static Reducer<BigDecimal, BigDecimal> bigDecimalAdditionAccumulator(); static Reducer<BigInteger, BigInteger> bigIntegerAdditionAccumulator(); static Reducer<Integer, Integer> integerMultiplicationAccumulator(); static Reducer<Long, Long> longMultiplicationAccumulator(); static Reducer<BigInteger, BigInteger> bigIntegerMultiplicationAccumulator(); static Reducer<Double, Double> doubleMultiplicationAccumulator(); static Reducer<Float, Float> floatMultiplicationAccumulator(); static Reducer<BigDecimal, BigDecimal> bigDecimalMultiplicationAccumulator(); }
Accumulators { public static Reducer<Integer, Integer> integerAdditionAccumulator() { return new Reducer<Integer, Integer>() { @Override public Integer accumulate(Integer accumulator, Integer element) { return accumulator + element; } }; } private  Accumulators(); static Reducer<Integer, Integer> integerAdditionAccumulator(); static Reducer<Long, Long> longAdditionAccumulator(); static Reducer<Double, Double> doubleAdditionAccumulator(); static Reducer<Float, Float> floatAdditionAccumulator(); static Reducer<BigDecimal, BigDecimal> bigDecimalAdditionAccumulator(); static Reducer<BigInteger, BigInteger> bigIntegerAdditionAccumulator(); static Reducer<Integer, Integer> integerMultiplicationAccumulator(); static Reducer<Long, Long> longMultiplicationAccumulator(); static Reducer<BigInteger, BigInteger> bigIntegerMultiplicationAccumulator(); static Reducer<Double, Double> doubleMultiplicationAccumulator(); static Reducer<Float, Float> floatMultiplicationAccumulator(); static Reducer<BigDecimal, BigDecimal> bigDecimalMultiplicationAccumulator();  }