ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/HashMap.java
(Generate patch)

Comparing jsr166/src/main/java/util/HashMap.java (file contents):
Revision 1.8 by jsr166, Mon Oct 1 00:10:53 2018 UTC vs.
Revision 1.10 by jsr166, Tue Dec 18 20:21:24 2018 UTC

# Line 34 | Line 34 | import java.util.function.BiConsumer;
34   import java.util.function.BiFunction;
35   import java.util.function.Consumer;
36   import java.util.function.Function;
37 < import jdk.internal.misc.SharedSecrets;
37 > // OPENJDK import jdk.internal.access.SharedSecrets;
38  
39   /**
40   * Hash table based implementation of the {@code Map} interface.  This
# Line 501 | Line 501 | public class HashMap<K,V> extends Abstra
501                           (int)ft : MAXIMUM_CAPACITY);
502                  if (t > threshold)
503                      threshold = tableSizeFor(t);
504 +            } else {
505 +                // Because of linked-list bucket constraints, we cannot
506 +                // expand all at once, but can reduce total resize
507 +                // effort by repeated doubling now vs later
508 +                while (s > threshold && table.length < MAXIMUM_CAPACITY)
509 +                    resize();
510              }
511 <            else if (s > threshold)
506 <                resize();
511 >
512              for (Map.Entry<? extends K, ? extends V> e : m.entrySet()) {
513                  K key = e.getKey();
514                  V value = e.getValue();
# Line 1444 | Line 1449 | public class HashMap<K,V> extends Abstra
1449  
1450              // Check Map.Entry[].class since it's the nearest public type to
1451              // what we're actually creating.
1452 <            SharedSecrets.getJavaObjectInputStreamAccess().checkArray(s, Map.Entry[].class, cap);
1452 >            jsr166.Platform.checkArray(s, Map.Entry[].class, cap);
1453              @SuppressWarnings({"rawtypes","unchecked"})
1454              Node<K,V>[] tab = (Node<K,V>[])new Node[cap];
1455              table = tab;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines