tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 58545] New: WsHandshakeRequest inefficient use of keySet
Date Sun, 25 Oct 2015 22:49:41 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=58545

            Bug ID: 58545
           Summary: WsHandshakeRequest inefficient use of keySet
           Product: Tomcat 8
           Version: trunk
          Hardware: Macintosh
                OS: Mac OS X 10.1
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: WebSocket
          Assignee: dev@tomcat.apache.org
          Reporter: anthony@whitford.com

Created attachment 33217
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33217&action=edit
Replaces inefficient use of keySet() with more efficient entrySet()

In WsHandshakeRequest...

        for (String pathName : pathParams.keySet()) {
            newParameters.put(pathName,
                    Collections.unmodifiableList(
                            Arrays.asList(pathParams.get(pathName))));
        }


should be:

        for (Entry<String,String> entry : pathParams.entrySet()) {
            final String pathName = entry.getKey();
            newParameters.put(pathName,
                    Collections.unmodifiableList(
                            Arrays.asList(entry.getValue())));
        }

to avoid the extra lookup.

See http://findbugs.sourceforge.net/bugDescriptions.html#WMI_WRONG_MAP_ITERATOR

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message