Skip to content

Commit

Permalink
Removed Iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Schönborn committed May 13, 2016
1 parent f5604f1 commit 5d238e4
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Optional;

import static com.google.common.collect.Iterators.addAll;
import static com.google.common.collect.Iterators.forEnumeration;
import static com.google.common.collect.Multimaps.unmodifiableListMultimap;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static java.util.Collections.list;

final class RemoteRequest extends HttpServletRequestWrapper implements RawHttpRequest, HttpRequest {

Expand Down Expand Up @@ -96,11 +94,10 @@ public String getQuery() {
@Override
public ListMultimap<String, String> getHeaders() {
final ListMultimap<String, String> headers = Headers.create();
final Iterator<String> names = forEnumeration(getHeaderNames());
final Iterable<String> names = list(getHeaderNames());

while (names.hasNext()) {
final String name = names.next();
addAll(headers.get(name), forEnumeration(getHeaders(name)));
for (final String name : names) {
headers.get(name).addAll(list(getHeaders(name)));
}

return unmodifiableListMultimap(headers);
Expand Down

0 comments on commit 5d238e4

Please sign in to comment.