< prev index next >
src/java.base/share/classes/java/util/regex/Pattern.java
Print this page
*** 5807,5820 ****
static final Node accept = new Node();
static final Node lastAccept = new LastNode();
/**
! * Creates a predicate which can be used to match a string.
*
! * @return The predicate which can be used for matching on a string
* @since 1.8
*/
public Predicate<String> asPredicate() {
return s -> matcher(s).find();
}
--- 5807,5830 ----
static final Node accept = new Node();
static final Node lastAccept = new LastNode();
/**
! * Creates a predicate that tests if for a given input string argument, an
! * input sequence, there exists a subsequence that 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 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 >