我需要计算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();
我需要计算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();