73 |
|
|
74 |
|
static Map<Integer,Integer> newMap(Class<?> cl) { |
75 |
|
try { |
76 |
< |
Map m = (Map<Integer,Integer>)cl.newInstance(); |
77 |
< |
return m; |
76 |
> |
return (Map<Integer,Integer>) cl.getConstructor().newInstance(); |
77 |
|
} catch (Exception e) { |
78 |
|
throw new RuntimeException("Can't instantiate " + cl + ": " + e); |
79 |
|
} |
438 |
|
t3("Put (presized) ", size, s, key, size); |
439 |
|
|
440 |
|
timer.start("Put (putAll) ", size * 2); |
441 |
< |
Map<Integer,Integer> s2 = null; |
441 |
> |
final Map<Integer,Integer> s2; |
442 |
|
try { |
443 |
< |
s2 = (Map<Integer,Integer>) (s.getClass().newInstance()); |
443 |
> |
s2 = (Map<Integer,Integer>) |
444 |
> |
s.getClass().getConstructor().newInstance(); |
445 |
|
s2.putAll(s); |
446 |
|
} |
447 |
|
catch (Exception e) { e.printStackTrace(); return; } |