Scala Product Map Values
In Scala the product of the map elements can be done by utilizing foldLeft method.
Here, m1 is used for a Map, foldLeft is a method that takes an initial value one for product. it will take previous result and multiply it to the next map key value. * and use 1 for the initial value to get the product of values.
Return Type: It returns the product of all the elements of the map.
Here, one in the foldLeft method is the initial value.