
com.github.geekonjava.query.criteria.CriteriaList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Purify4J Show documentation
Show all versions of Purify4J Show documentation
Simple library for use to refine the Java Collection Objects
The newest version!
package com.github.geekonjava.query.criteria;
import java.util.ArrayList;
import java.util.List;
public class CriteriaList {
private List> criterias;
public CriteriaList() {
criterias = new ArrayList>();
}
public void add(Criteria criteria) {
criterias.add(criteria);
}
public boolean match(T item) {
if (criterias.size() == 0) {
return true;
}
if (criterias.size() == 1) {
return criterias.get(0).match(item);
}
boolean matched = true;
for (int i = criterias.size() - 1; i > 0; i--) {
Criteria one = criterias.get(i);
Criteria other = criterias.get(i - 1);
matched = matched && one.specification().match(item, one, other);
}
return matched;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy