Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8201308

add Pattern.asMatchPredicate

    XMLWordPrintable

Details

    • CSR
    • Status: Closed
    • P3
    • Resolution: Approved
    • 11
    • core-libs
    • None
    • minimal
    • Java API
    • SE

    Description

      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

           /**
      +     * 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
      +     */
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: