kucci / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Constraints should have a static factory method to use a Predicate as a Constraint #407

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would seem natural to use a Predicate for a Constraint.

One use case may be that we want a Constraints.<String>constrainedList, whose 
Constraint is based on satisfying Predicates.<CharSequence>containsPattern.

Unfortunately there doesn't seem to be a way to adapt a Predicate as a 
Constraint right now. It's trivial for users to write this on their own, of 
course, but perhaps the need is widespread enough, and the idiom so natural, 
that Constraints should just provide a static factory method for such adapters.

Attached is my attempt to write it.

Original issue reported on code.google.com by yogy.nam...@gmail.com on 26 Aug 2010 at 5:26

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Sorry I should've searched first. Feel free to close as dupe.

http://code.google.com/p/guava-libraries/issues/detail?id=379&q=constraints
http://code.google.com/p/guava-libraries/issues/detail?id=402&q=constraints

(also, Predicates.<CharSequence>containsPattern is a typo)

Original comment by yogy.nam...@gmail.com on 26 Aug 2010 at 5:32

GoogleCodeExporter commented 9 years ago

Original comment by boppenh...@google.com on 30 Aug 2010 at 5:30

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09