Closed GoogleCodeExporter closed 9 years ago
Could you give an example of how you use a mutable Predicate?
Original comment by boppenh...@google.com
on 21 Nov 2010 at 7:06
Sure; I currently have a constraint problem where the constraints are
represented by Predicates. However, both individual constraints and the number
of constraints dynamically change. So, I'm using roughly the following:
MyOrPredicate<T> extends ForwardingSet<Predicate<T>> implements Predicate<T> {
//...forwarding set stuff, etc
public boolean apply(T input) {
for (Predicate<T> p : this) if (p.apply(input)) return true;
return false;
}
}
and then
MyPredicate<T> constraints = new MyPredicate<T>();
// ... adjust which constraints are in the predicate
if (constraints.apply(thing)) // ... do some stuff
// ... more adjustment of constraints
etc.
Original comment by blank...@gmail.com
on 21 Nov 2010 at 8:05
I'm afraid I see these as far too "niche" for Guava.
Original comment by kevinb@google.com
on 12 Jan 2011 at 10:47
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:15
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:09
Original issue reported on code.google.com by
blank...@gmail.com
on 19 Nov 2010 at 9:36