Sum.java 449 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();
    }
}