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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java (file contents):
Revision 1.54 by dl, Fri Dec 31 13:00:39 2004 UTC vs.
Revision 1.55 by dl, Fri Dec 31 18:38:37 2004 UTC

# Line 602 | Line 602 | public class ConcurrentHashMap<K, V> ext
602      }
603  
604      /**
605 +     * Creates a new, empty map with the specified initial capacity
606 +     * and load factor and with the default concurrencyLevel (16).
607 +     *
608 +     * @param initialCapacity The implementation performs internal
609 +     * sizing to accommodate this many elements.
610 +     * @param loadFactor  the load factor threshold, used to control resizing.
611 +     * @throws IllegalArgumentException if the initial capacity of
612 +     * elements is negative or the load factor is nonpositive
613 +     */
614 +    public ConcurrentHashMap(int initialCapacity, float loadFactor) {
615 +        this(initialCapacity, loadFactor, DEFAULT_SEGMENTS);
616 +    }
617 +
618 +    /**
619       * Creates a new, empty map with the specified initial
620 <     * capacity,  and with default load factor and concurrencyLevel.
620 >     * capacity,  and with default load factor (0.75f) and
621 >     * concurrencyLevel (16).
622       *
623       * @param initialCapacity The implementation performs internal
624       * sizing to accommodate this many elements.
# Line 615 | Line 630 | public class ConcurrentHashMap<K, V> ext
630      }
631  
632      /**
633 <     * Creates a new, empty map with a default initial capacity,
634 <     * load factor, and concurrencyLevel.
633 >     * Creates a new, empty map with a default initial capacity (16),
634 >     * load factor (0.75f), and concurrencyLevel (16).
635       */
636      public ConcurrentHashMap() {
637          this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS);
# Line 624 | Line 639 | public class ConcurrentHashMap<K, V> ext
639  
640      /**
641       * Creates a new map with the same mappings as the given map.  The
642 <     * map is created with a capacity of twice the number of mappings in
643 <     * the given map or 11 (whichever is greater), and a default load factor
644 <     * and concurrencyLevel.
642 >     * map is created with a capacity of 1.5 times the number of
643 >     * mappings in the given map or 16 (whichever is greater), and a
644 >     * default load factor (0.75f) and concurrencyLevel(16).
645       * @param t the map
646       */
647      public ConcurrentHashMap(Map<? extends K, ? extends V> t) {
648          this(Math.max((int) (t.size() / DEFAULT_LOAD_FACTOR) + 1,
649 <                      11),
649 >                      16),
650               DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS);
651          putAll(t);
652      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines