I have a list of conditions:
List<Condition> conditions = ...;
What is the easiest way to and-combine (or or-combine) these conditions into a new condition?
Condition condition = and(conditions);
Does JOOQ have a utility function for this? I agree it is easy to write, but I would rather not re-invent the wheel.
You can simply write:
Condition condition = DSL.and(conditions);
Before this was implemented in jOOQ 3.6 (#3904) you had to resort to writing your own method:
static Condition and(Collection<? extends Condition> conditions) {
Condition result = DSL.trueCondition();
for (Condition condition : conditions)
result = result.and(condition);
return result;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With