Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b04
    • CPU:
      generic
    • OS:
      generic

      Description

      A String method for repeating sequences of characters has been long requested with no follow through. There are also have been requests for repeat counts on Appendable#append but that would require significant coordination of Appendable implementations, including StringBuilder. Having basic repeat functionality the String will suffice for now.

          /**
           * Returns a string whose value is the concatenation of this
           * string repeated {@code count} times.
           * <p>
           * If this string is empty or count is zero then the empty
           * string is returned.
           *
           * @param count number of times to repeat
           *
           * @return A string composed of this string repeated
           * {@code count} times or the empty string if this
           * string is empty or count is zero
           *
           * @throws IllegalArgumentException if the {@code count} is
           * negative.
           *
           * @since 11
           */
          public String repeat(int count) {

      Webrev: http://cr.openjdk.java.net/~jlaskey/8197594/webrev-02/index.html
      JavaDoc: http://cr.openjdk.java.net/~jlaskey/8197594/String.html

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jlaskey Jim Laskey
                Reporter:
                jlaskey Jim Laskey
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: