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

Avoid redundant LinkedHashMap.get call in TagletManager.addNewSimpleCustomTag

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 20
    • None
    • tools

      In the method jdk.javadoc.internal.doclets.toolkit.taglets.TagletManager#addNewSimpleCustomTag

              Taglet tag = allTaglets.get(tagName);
              if (tag == null || header != null) {
                  allTaglets.remove(tagName);
                  allTaglets.put(tagName, new SimpleTaglet(tagName, header, locations));
                  if (Utils.toLowerCase(locations).indexOf('x') == -1) {
                      checkTagName(tagName);
                  }
              } else {
                  //Move to back
                  allTaglets.remove(tagName);
                  allTaglets.put(tagName, tag);
              }

      Instead of pair LinkedHashMap.get+LinkedHashMap.remove calls, we can use value returned from single allTaglets.remove call.
      It's shorter and a bit faster.

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

              Created:
              Updated:
              Resolved: