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

Avoid redundant HashMap.get call in NegotiateAuthentication.firstToken

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P5
    • 20
    • None
    • core-libs
    • b03

    Description

       HashMap <String, Negotiator> cachedMap = getCache();
       if (cachedMap != null) {
           negotiator = cachedMap.get(getHost());
           if (negotiator != null) {
               cachedMap.remove(getHost()); // so that it is only used once
           }
       }

      Instead of separate HashMap.get+remove call, we can use single HashMap.remove call and use its return value.
      It makes code a bit cleaner and faster.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: