mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8186958: Need method to create pre-sized HashMap
Reviewed-by: chegar, naoto, joehw, lancea, wetmore, smarks
This commit is contained in:
parent
41fc078323
commit
87faa85c59
30 changed files with 208 additions and 73 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -307,7 +307,7 @@ public final class OCSPResponse {
|
|||
|
||||
// responses
|
||||
DerValue[] singleResponseDer = seqDerIn.getSequence(1);
|
||||
singleResponseMap = new HashMap<>(singleResponseDer.length);
|
||||
singleResponseMap = HashMap.newHashMap(singleResponseDer.length);
|
||||
if (debug != null) {
|
||||
debug.println("OCSP number of SingleResponses: "
|
||||
+ singleResponseDer.length);
|
||||
|
@ -751,7 +751,7 @@ public final class OCSPResponse {
|
|||
parseExtensions(DerValue derVal) throws IOException {
|
||||
DerValue[] extDer = derVal.data.getSequence(3);
|
||||
Map<String, java.security.cert.Extension> extMap =
|
||||
new HashMap<>(extDer.length);
|
||||
HashMap.newHashMap(extDer.length);
|
||||
|
||||
for (DerValue extDerVal : extDer) {
|
||||
Extension ext = new Extension(extDerVal);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -481,7 +481,7 @@ class MemoryCache<K,V> extends Cache<K,V> {
|
|||
}
|
||||
|
||||
private Map<K,V> getCachedEntries() {
|
||||
Map<K,V> kvmap = new HashMap<>(cacheMap.size());
|
||||
Map<K,V> kvmap = HashMap.newHashMap(cacheMap.size());
|
||||
|
||||
for (CacheEntry<K,V> entry : cacheMap.values()) {
|
||||
kvmap.put(entry.getKey(), entry.getValue());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -157,7 +157,7 @@ public abstract class OpenListResourceBundle extends ResourceBundle {
|
|||
* Default uses HashMap.
|
||||
*/
|
||||
protected <K, V> Map<K, V> createMap(int size) {
|
||||
return new HashMap<>(size);
|
||||
return HashMap.newHashMap(size);
|
||||
}
|
||||
|
||||
protected <E> Set<E> createSet() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -96,7 +96,7 @@ public abstract class TimeZoneNamesBundle extends OpenListResourceBundle {
|
|||
*/
|
||||
@Override
|
||||
protected <K, V> Map<K, V> createMap(int size) {
|
||||
return new LinkedHashMap<>(size);
|
||||
return LinkedHashMap.newLinkedHashMap(size);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue