Sum.java
381 Bytes
package kernel.function;
import kernel.Cell;
import kernel.LanguageEnum;
import java.util.List;
public class Sum extends Function {
public Sum(List<Cell> listCells) {
super(listCells);
this.names.put(LanguageEnum.FR, "SOMME");
this.names.put(LanguageEnum.EN, "SUM");
}
public double eval() {
return this.listCells.stream().mapToDouble(Cell::getValue).sum();
}
}