Preloader: HashMap constructor takes capacity, not expected size

This commit is contained in:
Alexander Udalov
2014-12-29 17:04:38 +03:00
parent 8306ccd8ec
commit 480f990c1d
@@ -108,7 +108,8 @@ public class ClassPreloadingUtils {
int classNumberEstimate, int classNumberEstimate,
ClassHandler handler ClassHandler handler
) throws IOException { ) throws IOException {
Map<String, Object> resources = new HashMap<String, Object>(classNumberEstimate); // 0.75 is HashMap.DEFAULT_LOAD_FACTOR
Map<String, Object> resources = new HashMap<String, Object>((int) (classNumberEstimate / 0.75));
for (File jarFile : jarFiles) { for (File jarFile : jarFiles) {
if (handler != null) { if (handler != null) {