Skip to content
Permalink
Browse files

Improved: Rewrite ‘CustomPermissivePolicy#matchesEither’ static method

(OFBIZ-10187)

It now uses a lambda expression instead of an anonymous class.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1858933 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed May 8, 2019
1 parent 344e294 commit 247367871c9c5a1fd4a2b3b4b23e983c2f331ee2
@@ -155,13 +155,15 @@
"picture", "source", "section", "nav", "footer")
.toFactory();

private static Predicate<String> matchesEither(
final Pattern a, final Pattern b) {
return new Predicate<String>() {
public boolean apply(String s) {
return a.matcher(s).matches() || b.matcher(s).matches();
}
};
/**
* Constructs a predicate checking if a string matches any of the two provided patterns.
*
* @param a the first pattern
* @param b the second pattern
* @return a predicate checking if a string matches either {@code a} or {@code b}
*/
private static Predicate<String> matchesEither(Pattern a, Pattern b) {
return str -> a.matcher(str).matches() || b.matcher(str).matches();
}

@Override

0 comments on commit 2473678

Please sign in to comment.
You can’t perform that action at this time.