Upgrade Regex with a tester() method?
paul.sandoz at oracle.com
Mon Jan 21 01:25:46 PST 2013
On Jan 20, 2013, at 7:04 PM, Peter Levart <peter.levart at gmail.com> wrote:
> On 01/04/2013 04:07 PM, Brian Goetz wrote:
>> Seems a nice "point lambdafication" suggestion. (The naming convention
>> we've been using as "asPredicate()".)
>> Regex is one of those areas where we wanted to do more with
>> lambdafication, but just didn't have the time to work through it. If
>> you want to suggest more...
> If that is being considered, I would suggest to include all 3 variants
> of matching (corresponding to 3 methods of Matcher):
> public Predicate<String> asFindPredicate()
> public Predicate<String> asLookingAtPredicate()
> public Predicate<String> asMatchesPredicate()
> Without "as" might even sound better since there are three of them:
> public Predicate<String> findPredicate()
> public Predicate<String> lookingAtPredicate()
> public Predicate<String> matchesPredicate()
I question whether such methods carry enough weight, given that it is really easy to state:
() -> p.find()
My preference is to encourage usage of such expressions rather than pick some boolean returning zero parameter methods of some classes to be "overloaded" with Predicate-based alternatives.
More information about the lambda-dev