Replaced use of inefficient keyset with use of entryset.

This commit is contained in:
Luc Maisonobe 2015-11-03 12:12:19 +01:00
parent b6c2d697ab
commit 9672399666
1 changed files with 4 additions and 4 deletions

View File

@ -283,12 +283,12 @@ public class ExceptionContext implements Serializable {
private void serializeContext(ObjectOutputStream out) private void serializeContext(ObjectOutputStream out)
throws IOException { throws IOException {
// Step 1. // Step 1.
final int len = context.keySet().size(); final int len = context.size();
out.writeInt(len); out.writeInt(len);
for (String key : context.keySet()) { for (Map.Entry<String, Object> entry : context.entrySet()) {
// Step 2. // Step 2.
out.writeObject(key); out.writeObject(entry.getKey());
final Object value = context.get(key); final Object value = entry.getValue();
if (value instanceof Serializable) { if (value instanceof Serializable) {
// Step 3a. // Step 3a.
out.writeObject(value); out.writeObject(value);