add Pattern.asMatchPredicate

XMLWordPrintable

    • Type: CSR
    • Resolution: Approved
    • Priority: P3
    • 11
    • Component/s: core-libs
    • None
    • minimal
    • Java API
    • SE

      Summary

      A new method Pattern.asMatchPredicate that converts a pattern into a predicate using Matcher.matches.

      Problem

      A method that converts a pattern into a predicate using Matcher.find already exists. It would be helpful to have a similar method that creates a predicate using Matcher.matches.

      Solution

      A new method that produces a predicate using the semantics of Matcher.match.

      Specification

      <pre> /** + * Creates a predicate that tests if this pattern matches a given input string. + * + * @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 + */ </pre>

            Assignee:
            Vivek Theeyarath (Inactive)
            Reporter:
            Stuart Marks
            Paul Sandoz, Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: