8186958: Need method to create pre-sized HashMap

Reviewed-by: chegar, naoto, joehw, lancea, wetmore, smarks
This commit is contained in:
XenoAmess 2022-04-19 00:03:56 +00:00 committed by Stuart Marks
parent 41fc078323
commit 87faa85c59
30 changed files with 208 additions and 73 deletions

View file

@ -1655,7 +1655,7 @@ public class Thread implements Runnable {
// Get a snapshot of the list of all threads
Thread[] threads = getThreads();
StackTraceElement[][] traces = dumpThreads(threads);
Map<Thread, StackTraceElement[]> m = new HashMap<>(threads.length);
Map<Thread, StackTraceElement[]> m = HashMap.newHashMap(threads.length);
for (int i = 0; i < threads.length; i++) {
StackTraceElement[] stackTrace = traces[i];
if (stackTrace != null) {