From 96723996663a595cb1d491b09e0a1707a01dc5f0 Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Tue, 3 Nov 2015 12:12:19 +0100 Subject: [PATCH] Replaced use of inefficient keyset with use of entryset. --- .../commons/math3/exception/util/ExceptionContext.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/math3/exception/util/ExceptionContext.java b/src/main/java/org/apache/commons/math3/exception/util/ExceptionContext.java index a9fd95cec..1a78bd38f 100644 --- a/src/main/java/org/apache/commons/math3/exception/util/ExceptionContext.java +++ b/src/main/java/org/apache/commons/math3/exception/util/ExceptionContext.java @@ -283,12 +283,12 @@ public class ExceptionContext implements Serializable { private void serializeContext(ObjectOutputStream out) throws IOException { // Step 1. - final int len = context.keySet().size(); + final int len = context.size(); out.writeInt(len); - for (String key : context.keySet()) { + for (Map.Entry entry : context.entrySet()) { // Step 2. - out.writeObject(key); - final Object value = context.get(key); + out.writeObject(entry.getKey()); + final Object value = entry.getValue(); if (value instanceof Serializable) { // Step 3a. out.writeObject(value);