io.github.geraldnguyen.excel.BaseIfs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of excel-formula Show documentation
Show all versions of excel-formula Show documentation
Implementation of popular excel formula in Java
The newest version!
package io.github.geraldnguyen.excel;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public abstract class BaseIfs {
protected List ifs(List range, RangeCriteria>... rangeCriteria) {
var size = range.size();
for (var rc : rangeCriteria) {
int providedSize = rc.range.size();
if (providedSize > size) {
throw new IllegalArgumentException("Invalid range, max expected: " + size + ", provided: " + providedSize);
}
}
var finalist = ifs(rangeCriteria);
return finalist.stream().map(range::get).collect(Collectors.toList());
}
protected Set ifs(RangeCriteria>... rangeCriteria) {
var eligibles = Arrays.stream(rangeCriteria).map(rc -> {
var list = (List