OrPredicate extends CompositePredicate<T> { @Override public boolean test(T t) { return getOperands().stream().anyMatch(o -> o.test(t)); } @SafeVarargs  OrPredicate(SerializablePredicate<T>... predicates); @Override boolean test(T t); @Override @SuppressWarnings("unchecked") SerializablePredicate<T> or(Predicate<? super T> other);  }
@Test public void test() { EqualsPredicate<TestEntity> p1 = new EqualsPredicate<>("name", "Bob"); EqualsPredicate<TestEntity> p2 = new EqualsPredicate<>("age", 44L); OrPredicate<TestEntity> or = new OrPredicate<>(p1); TestEntity t1 = new TestEntity(); t1.setName("Bob"); t1.setAge(45L); assertTrue(or.test(t1)); or = new OrPredicate<>(p1, p2); assertTrue(or.test(t1)); t1.setName("Kevin"); assertFalse(or.test(t1)); }