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

Avoid redundant HashMap.get call in NegotiateAuthentication.firstToken

XMLWordPrintable

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

       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.

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

              Created:
              Updated:
              Resolved: