In the given question the line "q2" is wrong because c1 is an int and cant use length().
Can someone explain me, why c1 is an int? I thought c1 and c2 stands both for the elements in the list which are strings.
If you look at the API of the three-parameter version of reduce, you'll see that it starts with U identity. You start with the Int 0, so java knows the U is an Int. The second line should be a BiFunction<Integer, String, Integer> and so you are right: it should be c1 + c2.length()
There are three kinds of actuaries: those who can count, and those who can't.
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.