From 50015fa5399fb4ca7714fc41e1d8615a0f801ef2 Mon Sep 17 00:00:00 2001 From: Ben Liblit Date: Mon, 7 Oct 2024 20:49:57 -0400 Subject: [PATCH] Iterate over Map entries to avoid extra lookups --- .../java/com/ibm/wala/dataflow/graph/DataflowSolver.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/src/main/java/com/ibm/wala/dataflow/graph/DataflowSolver.java b/util/src/main/java/com/ibm/wala/dataflow/graph/DataflowSolver.java index c1b354a14..0acf3ddf7 100644 --- a/util/src/main/java/com/ibm/wala/dataflow/graph/DataflowSolver.java +++ b/util/src/main/java/com/ibm/wala/dataflow/graph/DataflowSolver.java @@ -22,6 +22,7 @@ import com.ibm.wala.util.graph.Graph; import com.ibm.wala.util.intset.IntegerUnionFind; import java.util.Map; +import java.util.Map.Entry; import org.jspecify.annotations.NullUnmarked; import org.jspecify.annotations.Nullable; @@ -119,9 +120,9 @@ private class UnionFind { private final Object[] allKeys; private int mapIt(int i, Object[] allVars, Map varMap) { - for (Object key : varMap.keySet()) { - allKeys[i] = key; - allVars[i++] = varMap.get(key); + for (Entry entry : varMap.entrySet()) { + allKeys[i] = entry.getKey(); + allVars[i++] = entry.getValue(); } return i;