Sepehr Sobhani Sepehr Sobhani - 6 months ago 8
Java Question

Get the product of a list using java Lambdas

How do you get the product of a array using java Lambdas. I know in C# it is like this:

result = array.Aggregate((a, b) => b * a);


edit: made the question more clear.

Answer
list.stream().reduce(1, (a, b) -> a * b);
Comments