Java.
RuleEngine<T> { private List<TestRule> rules; public RuleEngine() { this.rules = new ArrayList<>(); } public void addRule(TestRule rule) { rules.add(rule); } public List<T> filter(List<T> items) { List<T> filteredItems = new ArrayList<>(); for (T item : items) { if (rules.stream().allMatch(rule ->