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

Use String.blank in jdk.javadoc where applicable

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P5
    • 18
    • None
    • tools
    • 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

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

                Dates

                  Created:
                  Updated:
                  Resolved: