mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8164781: Pattern.asPredicate specification is incomplete
Updated specification to reflect usage of find() Reviewed-by: psandoz
This commit is contained in:
parent
10201f5b2f
commit
824df1c125
2 changed files with 16 additions and 2 deletions
|
@ -5809,10 +5809,21 @@ NEXT: while (i <= last) {
|
|||
static final Node lastAccept = new LastNode();
|
||||
|
||||
/**
|
||||
* Creates a predicate which can be used to match a string.
|
||||
* Creates a predicate that tests if this pattern is found in a given input
|
||||
* string.
|
||||
*
|
||||
* @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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue