Reports fold
and reduce
methods that could be replaced with sum
,
product
, max
, or min
.
Example:
List(1, 2, 3).foldLeft(1){(x,y) => x * y}
List(1, 2, 3).fold(0)(_ + _)
List(1, 2, 3).reduce(_ + _)
List(1, 2, 3).reduceLeft(_ min _)
List(1, 2, 3).reduce((x, y) => math.max(x, y))
After the quick-fix is applied:
List(1, 2, 3).product
List(1, 2, 3).sum
List(1, 2, 3).sum
List(1, 2, 3).min
List(1, 2, 3).max