Skip to content

Commit

Permalink
Use for-each
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Sep 22, 2024
1 parent e9560a4 commit 1c0e373
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ protected void formatMultipartHeader(final MultipartPart part, final OutputStrea
writeBytes(FIELD_SEP, out);
writeBytes(field.getValue(), out);
final List<NameValuePair> parameters = field.getParameters();
for (int i = 0; i < parameters.size(); i++) {
final NameValuePair parameter = parameters.get(i);
for (final NameValuePair parameter : parameters) {
final String name = parameter.getName();
final String value = parameter.getValue();
writeBytes("; ", out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ private void logFlowControl(final String prefix, final int streamId, final int d
@Override
public void onHeaderInput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
if (HEADER_LOG.isDebugEnabled()) {
for (int i = 0; i < headers.size(); i++) {
HEADER_LOG.debug("{} << {}", id, headers.get(i));
for (final Header header : headers) {
HEADER_LOG.debug("{} << {}", id, header);
}
}
}

@Override
public void onHeaderOutput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
if (HEADER_LOG.isDebugEnabled()) {
for (int i = 0; i < headers.size(); i++) {
HEADER_LOG.debug("{} >> {}", id, headers.get(i));
for (final Header header : headers) {
HEADER_LOG.debug("{} >> {}", id, header);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,17 @@ private void logFlowControl(final String prefix, final int streamId, final int d
@Override
public void onHeaderInput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
if (HEADER_LOG.isDebugEnabled()) {
for (int i = 0; i < headers.size(); i++) {
HEADER_LOG.debug("{} << {}", id, headers.get(i));
for (final Header header : headers) {
HEADER_LOG.debug("{} << {}", id, header);
}
}
}

@Override
public void onHeaderOutput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
if (HEADER_LOG.isDebugEnabled()) {
for (int i = 0; i < headers.size(); i++) {
HEADER_LOG.debug("{} >> {}", id, headers.get(i));
for (final Header header : headers) {
HEADER_LOG.debug("{} >> {}", id, header);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public static void main(final String[] args) throws Exception {
System.out.println("----------------------------------------");
System.out.println(httpget + "->" + new StatusLine(response));
final List<Cookie> cookies = cookieStore.getCookies();
for (int i = 0; i < cookies.size(); i++) {
System.out.println("Local cookie: " + cookies.get(i));
for (final Cookie element : cookies) {
System.out.println("Local cookie: " + element);
}
EntityUtils.consume(response.getEntity());
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public static void main(final String[] args) throws Exception {
if (cookies.isEmpty()) {
System.out.println("None");
} else {
for (int i = 0; i < cookies.size(); i++) {
System.out.println("- " + cookies.get(i));
for (final Cookie element : cookies) {
System.out.println("- " + element);
}
}
return null;
Expand All @@ -82,8 +82,8 @@ public static void main(final String[] args) throws Exception {
if (cookies.isEmpty()) {
System.out.println("None");
} else {
for (int i = 0; i < cookies.size(); i++) {
System.out.println("- " + cookies.get(i));
for (final Cookie element : cookies) {
System.out.println("- " + element);
}
}
return null;
Expand Down

0 comments on commit 1c0e373

Please sign in to comment.