Upgrade Regex with a tester() method?
Remi Forax
forax at univ-mlv.fr
Thu Jan 3 09:02:50 PST 2013
On 01/03/2013 03:49 PM, 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.
Hi Ben,
this should work:
Predicate<String> predicate = pattern.matcher(s)::find;
> Thanks,
>
> Ben
>
cheers,
Rémi
More information about the lambda-dev
mailing list