Java.
person.getName().startsWith("B")); private final Predicate<Person> predicate; Rule(Predicate<Person> predicate) { this.predicate = predicate; } public Predicate<Person> getPredicate() { return predicate; } } Creating the Rule Engine: Next, we create the RuleEngine class. This class will handle the