我需要计算Iterable<Integer>的总和。

final Iterable<Integer> score = this.points()
final sum = new SumOfInts(...).value()


如何使用类SumOfInts做到这一点?

最佳答案

Cactoos 0.22开始,您可以:

int sum = new SumOf(1, 2, 3).intValue();

10-04 10:06