public KeyAndPredicate<S, K> mergeWith(KeyAndPredicate<S, K> keyAndPredicate) { if (!this.key.equals(keyAndPredicate.key)) throw new IllegalArgumentException(); if (this.predicate == null || keyAndPredicate.predicate == null) { // null is equivalent to true return this; } if (this.predicate.equals(keyAndPredicate.predicate)) { return this; } return new KeyAndPredicate<S, K>(key, new OrPredicate<S>(predicate, keyAndPredicate.predicate)); }
public KeyAndPredicate<S, K> mergeWith(KeyAndPredicate<S, K> keyAndPredicate) { if (!this.key.equals(keyAndPredicate.key)) throw new IllegalArgumentException(); if (this.predicate == null || keyAndPredicate.predicate == null) { // null is equivalent to true return this; } if (this.predicate.equals(keyAndPredicate.predicate)) { return this; } return new KeyAndPredicate<S, K>(key, new OrPredicate<S>(predicate, keyAndPredicate.predicate)); }