|
26 | 26 | package org.graalvm.visualvm.lib.jfluid.results.cpu;
|
27 | 27 |
|
28 | 28 | import org.graalvm.visualvm.lib.jfluid.utils.IntVector;
|
29 |
| -import java.util.Enumeration; |
30 |
| -import java.util.Hashtable; |
| 29 | +import java.util.HashSet; |
| 30 | +import java.util.Iterator; |
| 31 | +import java.util.Set; |
31 | 32 |
|
32 | 33 |
|
33 | 34 | /**
|
@@ -127,7 +128,7 @@ protected int generateClassNodeFromMethodNodes(IntVector methodNodes, int dataOf
|
127 | 128 | // Now add all the children of methodNodes that have the same class, to thisNode, and collect the rest of the
|
128 | 129 | // children of methodNodes into sourceChildren vector.
|
129 | 130 | IntVector sourceChildren = new IntVector();
|
130 |
| - Hashtable uniqChildrenCache = new Hashtable(); |
| 131 | + Set uniqChildrenCache = new HashSet(); |
131 | 132 |
|
132 | 133 | for (int i = 0; i < nMethodNodes; i++) {
|
133 | 134 | int methodNodeOfs = methodNodes.get(i);
|
@@ -174,12 +175,12 @@ protected int generateClassNodeFromMethodNodes(IntVector methodNodes, int dataOf
|
174 | 175 | .get(i)));
|
175 | 176 | }
|
176 | 177 |
|
177 |
| - Enumeration e = uniqChildrenCache.elements(); |
| 178 | + Iterator e = uniqChildrenCache.iterator(); |
178 | 179 |
|
179 |
| - for (int i = 0; e.hasMoreElements(); i++) { |
| 180 | + for (int i = 0; e.hasNext(); i++) { |
180 | 181 | sameTypeChildren.clear();
|
181 | 182 |
|
182 |
| - int sourceChildClassOrPackageId = ((Integer) e.nextElement()).intValue(); |
| 183 | + int sourceChildClassOrPackageId = ((Integer) e.next()).intValue(); |
183 | 184 |
|
184 | 185 | for (int j = 0; j < nAllChildren; j++) {
|
185 | 186 | if (sourceChildrenClassIds[j] == sourceChildClassOrPackageId) {
|
@@ -221,7 +222,7 @@ protected int generateClassNodeFromMethodNodes(IntVector methodNodes, int dataOf
|
221 | 222 | * 3. All other source children are added to allSourceChildren, but not to uniqChildCache.
|
222 | 223 | */
|
223 | 224 | protected void processChildren(int dataOfs, int methodNodeOfs, int nChildren, IntVector allSourceChildren,
|
224 |
| - Hashtable uniqChildCache) { |
| 225 | + Set uniqChildCache) { |
225 | 226 | int thisNodeClassOrPackageId = getMethodIdForNodeOfs(dataOfs);
|
226 | 227 |
|
227 | 228 | int nCalls = 0;
|
@@ -250,10 +251,7 @@ protected void processChildren(int dataOfs, int methodNodeOfs, int nChildren, In
|
250 | 251 |
|
251 | 252 | Integer key = Integer.valueOf(sourceChildClassOrPackageId);
|
252 | 253 |
|
253 |
| - if (!uniqChildCache.containsKey(key)) { |
254 |
| - uniqChildCache.put(key, key); |
255 |
| - } |
256 |
| - |
| 254 | + uniqChildCache.add(key); |
257 | 255 | allSourceChildren.add(sourceChildOfs);
|
258 | 256 | }
|
259 | 257 | }
|
|
0 commit comments