Upgrade Regex with a tester() method?

Sam Pullara spullara at gmail.com
Sun Jan 20 10:54:41 PST 2013

Don't these overload nicely and we can leave off the Predicate part?
Not a fan of including the type if we can avoid it.


All my photos are panoramas.

On Jan 20, 2013, at 10:14 AM, 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()
> Regards, Peter
>> On 1/3/2013 9:49 AM, Ben Evans wrote:
>>> Hi,
>>> I've been thinking about places to include lambdas outside of the
>>> collections libs.
>>> I've had a look through the archives but can't find any obvious
>>> discussion of this topic, so am posting here. If there are threads
>>> I've missed - please point me at them.
>>> What about upgrading java.util.regex.Pattern to include this method
>>> (and / or similar):
>>> public Predicate<String> tester(){
>>>      return s -> this.matcher(s).find();
>>> }
>>> When writing articles and labs code which uses lambdas, I've found
>>> myself writing helper classes to achieve a similar effect, and it
>>> occurred to me that this could be a better way to solve the problem.
>>> Thanks,
>>> Ben

More information about the lambda-dev mailing list