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

Use String.blank in jdk.javadoc where applicable

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 18
    • Component/s: tools
    • Labels:
      None

      Backports

        Description

        There are couple of places where manual cycle is used to check if String contains non-whitespaces characters.
        Since Java 11 we have String.isBlank() which could be used instead.

            boolean isAllWhiteSpace(String body) {
                for (int i = 0 ; i < body.length(); i++) {
                    if (!Character.isWhitespace(body.charAt(i)))
                        return false;
                }
                return true;
            }

            boolean hasNonWhitespace(TextTree tree) {
                String s = tree.getBody();
                for (int i = 0; i < s.length(); i++) {
                    Character c = s.charAt(i);
                    if (!Character.isWhitespace(s.charAt(i)))
                        return true;
                }
                return false;
            }

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                aturbanov Andrey Turbanov
                Reporter:
                aturbanov Andrey Turbanov
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: