I am trying to use reduce methods on a stream of Integer to get sum of all values. but getting syntax error and not able to figure out the error.
List<Integer> ee = new ArrayList<Integer>();
Function<? super Integer, ? extends Integer> f3 = x -> x / 2;
BinaryOperator<? extends Integer> accumulator = (x, y) -> x + y;
ee.stream().map(f3).reduce(new Integer(0), accumulator);
It gives error :
The method reduce(capture#2-of ? extends Integer, BinaryOperator<capture#2-of ? extends Integer>) in the type Stream<capture#2-of ? extends Integer> is not applicable for the arguments (Integer, BinaryOperator<capture#7-of ? extends Integer>)