< prev index next >
src/java.base/share/classes/java/util/regex/Pattern.java
Print this page
@@ -5807,14 +5807,23 @@
static final Node accept = new Node();
static final Node lastAccept = new LastNode();
/**
- * Creates a predicate which can be used to match a string.
+ * Creates a predicate that tests if for a given input string argument, an
+ * input sequence, there exists a subsequence that matches this pattern.
*
- * @return The predicate which can be used for matching on a string
+ * @apiNote
+ * This method creates a predicate that behaves as if it creates a matcher from the input sequence
+ * and then calls {@code find}, for example a predicate of the form:
+ * <pre>{@code
+ * s -> matcher(s).find();
+ * }</pre>
+ *
+ * @return The predicate which can be used for finding a match on a subsequence of a string
* @since 1.8
+ * @see Matcher#find
*/
public Predicate<String> asPredicate() {
return s -> matcher(s).find();
}
< prev index next >