@@ -102,14 +102,16 @@ private static Map<String, List<String>> getHeaders(HttpServletRequest request)
102102
103103 // Headers are case-insensitive
104104 Map <String , List <String >> headers = new TreeMap <>(String .CASE_INSENSITIVE_ORDER );
105- names .asIterator ().forEachRemaining ((String name ) -> {
105+ while (names .hasMoreElements ()) {
106+
107+ String name = names .nextElement ();
106108
107109 @ SuppressWarnings ("unchecked" ) // getHeaders() is explicitly documented as returning a Enumeration<String>
108110 Enumeration <String > values = (Enumeration <String >) request .getHeaders (name );
109111 if (values != null && values .hasMoreElements ())
110112 headers .put (name , Collections .unmodifiableList (Collections .list (values )));
111113
112- });
114+ }
113115
114116 return Collections .unmodifiableMap (headers );
115117
@@ -139,13 +141,15 @@ private static Map<String, List<String>> getParameters(HttpServletRequest reques
139141
140142 // Unlike headers, parameters are case-sensitive
141143 Map <String , List <String >> parameters = new HashMap <>();
142- names .asIterator ().forEachRemaining ((String name ) -> {
144+ while (names .hasMoreElements ()) {
145+
146+ String name = names .nextElement ();
143147
144148 String [] values = request .getParameterValues (name );
145149 if (values != null && values .length != 0 )
146150 parameters .put (name , Collections .unmodifiableList (Arrays .asList (values )));
147151
148- });
152+ }
149153
150154 return Collections .unmodifiableMap (parameters );
151155
0 commit comments