--- old/src/java.base/share/classes/java/util/regex/Pattern.java 2018-04-09 01:56:44.064798201 -0700 +++ new/src/java.base/share/classes/java/util/regex/Pattern.java 2018-04-09 01:56:43.787772694 -0700 @@ -5819,6 +5819,26 @@ } /** + * Creates a predicate that tests if a given input string argument, + * an input sequence, matches this pattern. + * + * @apiNote + * This method creates a predicate that behaves as if it creates a matcher + * from the input sequence and then calls {@code matches}, for example a + * predicate of the form: + *
{@code
+     *   s -> matcher(s).matches();
+     * }
+ * + * @return The predicate which can be used for matching an input string + * against this pattern. + * @since 11 + * @see Matcher#matches + */ + public Predicate asMatchPredicate() { + return s -> matcher(s).matches(); + } + /** * Creates a stream from the given input sequence around matches of this * pattern. *