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

add Pattern.asMatchPredicate

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Java API
    • Scope:
      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

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

                Dates

                Created:
                Updated:
                Resolved: