Use Collections.emptyIterator instead of grabbing the iterator from an empty list.

Resolves #1327.
This commit is contained in:
hduelme
2023-01-26 21:41:55 +01:00
committed by Greg L. Turnquist
parent f2bfc4acce
commit aee1243d6c
5 changed files with 5 additions and 5 deletions

View File

@@ -98,7 +98,7 @@ public class ClientHttpRequestConnection extends AbstractHttpSenderConnection {
@Override
public Iterator<String> getResponseHeaders(String name) throws IOException {
List<String> headers = response.getHeaders().get(name);
return headers != null ? headers.iterator() : Collections.<String> emptyList().iterator();
return headers != null ? headers.iterator() : Collections.emptyIterator();
}
@Override

View File

@@ -132,7 +132,7 @@ public class HttpUrlConnection extends AbstractHttpSenderConnection {
List<String> headerValues = headersListMappedByLowerCaseName.get(name.toLowerCase());
if (headerValues == null) {
return Collections.<String> emptyList().iterator();
return Collections.emptyIterator();
} else {
return headerValues.iterator();
}

View File

@@ -109,7 +109,7 @@ public class HttpExchangeConnection extends AbstractReceiverConnection
@Override
public Iterator<String> getRequestHeaders(String name) throws IOException {
List<String> headers = httpExchange.getRequestHeaders().get(name);
return headers != null ? headers.iterator() : Collections.<String> emptyList().iterator();
return headers != null ? headers.iterator() : Collections.emptyIterator();
}
@Override

View File

@@ -154,7 +154,7 @@ public abstract class JmsTransportUtils {
if (value != null) {
return Collections.singletonList(value).iterator();
} else {
return Collections.<String> emptyList().iterator();
return Collections.emptyIterator();
}
}

View File

@@ -74,7 +74,7 @@ public abstract class XmppTransportUtils {
if (value != null) {
return Collections.singletonList(value).iterator();
} else {
return Collections.<String> emptyList().iterator();
return Collections.emptyIterator();
}
}