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

Comparing jsr166/src/jsr166e/ConcurrentHashMapV8.java (file contents):
Revision 1.16 by dl, Fri Sep 9 13:02:01 2011 UTC vs.
Revision 1.21 by jsr166, Sat Sep 10 05:35:24 2011 UTC

# Line 85 | Line 85 | import java.io.Serializable;
85   * <p><em>jsr166e note: This class is a candidate replacement for
86   * java.util.concurrent.ConcurrentHashMap.<em>
87   *
88 < * @since 1.5
88 > * @since 1.8
89   * @author Doug Lea
90   * @param <K> the type of keys maintained by this map
91   * @param <V> the type of mapped values
# Line 422 | Line 422 | public class ConcurrentHashMapV8<K, V>
422          return table;
423      }
424  
425 <    /*
425 >    /**
426       * Reclassifies nodes in each bin to new table.  Because we are
427       * using power-of-two expansion, the elements from each bin must
428       * either stay at same index, or move with a power of two
# Line 775 | Line 775 | public class ConcurrentHashMapV8<K, V>
775       *
776       * Exported iterators (subclasses of ViewIterator) extract key,
777       * value, or key-value pairs as return values of Iterator.next(),
778 <     * and encapulate the it.next check as hasNext();
778 >     * and encapsulate the it.next check as hasNext();
779       *
780       * The iterator visits each valid node that was reachable upon
781       * iterator construction once. It might miss some that were added
# Line 866 | Line 866 | public class ConcurrentHashMapV8<K, V>
866       * @param initialCapacity The implementation performs internal
867       * sizing to accommodate this many elements.
868       * @throws IllegalArgumentException if the initial capacity of
869 <     * elements is negative.
869 >     * elements is negative
870       */
871      public ConcurrentHashMapV8(int initialCapacity) {
872          if (initialCapacity < 0)
# Line 898 | Line 898 | public class ConcurrentHashMapV8<K, V>
898       * performs internal sizing to accommodate this many elements,
899       * given the specified load factor.
900       * @param loadFactor the load factor (table density) for
901 <     * establishing the initial table size.
901 >     * establishing the initial table size
902       * @throws IllegalArgumentException if the initial capacity of
903       * elements is negative or the load factor is nonpositive
904     *
905     * @since 1.6
904       */
905      public ConcurrentHashMapV8(int initialCapacity, float loadFactor) {
906          this(initialCapacity, loadFactor, 1);
# Line 918 | Line 916 | public class ConcurrentHashMapV8<K, V>
916       * performs internal sizing to accommodate this many elements,
917       * given the specified load factor.
918       * @param loadFactor the load factor (table density) for
919 <     * establishing the initial table size.
919 >     * establishing the initial table size
920       * @param concurrencyLevel the estimated number of concurrently
921       * updating threads. The implementation may use this value as
922       * a sizing hint.
923       * @throws IllegalArgumentException if the initial capacity is
924       * negative or the load factor or concurrencyLevel are
925 <     * nonpositive.
925 >     * nonpositive
926       */
927      public ConcurrentHashMapV8(int initialCapacity,
928                                 float loadFactor, int concurrencyLevel) {
# Line 980 | Line 978 | public class ConcurrentHashMapV8<K, V>
978       * @param  key   possible key
979       * @return {@code true} if and only if the specified object
980       *         is a key in this table, as determined by the
981 <     *         {@code equals} method; {@code false} otherwise.
981 >     *         {@code equals} method; {@code false} otherwise
982       * @throws NullPointerException if the specified key is null
983       */
984      public boolean containsKey(Object key) {
# Line 1117 | Line 1115 | public class ConcurrentHashMapV8<K, V>
1115       * @param mappingFunction the function to compute a value
1116       * @return the current (existing or computed) value associated with
1117       *         the specified key, or {@code null} if the computation
1118 <     *         returned {@code null}.
1118 >     *         returned {@code null}
1119       * @throws NullPointerException if the specified key or mappingFunction
1120 <     *         is null,
1120 >     *         is null
1121       * @throws IllegalStateException if the computation detectably
1122       *         attempts a recursive update to this map that would
1123 <     *         otherwise never complete.
1123 >     *         otherwise never complete
1124       * @throws RuntimeException or Error if the mappingFunction does so,
1125 <     *         in which case the mapping is left unestablished.
1125 >     *         in which case the mapping is left unestablished
1126       */
1127      public V computeIfAbsent(K key, MappingFunction<? super K, ? extends V> mappingFunction) {
1128          if (key == null || mappingFunction == null)
# Line 1154 | Line 1152 | public class ConcurrentHashMapV8<K, V>
1152       * @param mappingFunction the function to compute a value
1153       * @return the current value associated with
1154       *         the specified key, or {@code null} if the computation
1155 <     *         returned {@code null} and the value was not otherwise present.
1155 >     *         returned {@code null} and the value was not otherwise present
1156       * @throws NullPointerException if the specified key or mappingFunction
1157 <     *         is null,
1157 >     *         is null
1158       * @throws IllegalStateException if the computation detectably
1159       *         attempts a recursive update to this map that would
1160 <     *         otherwise never complete.
1160 >     *         otherwise never complete
1161       * @throws RuntimeException or Error if the mappingFunction does so,
1162 <     *         in which case the mapping is unchanged.
1162 >     *         in which case the mapping is unchanged
1163       */
1164      public V compute(K key, MappingFunction<? super K, ? extends V> mappingFunction) {
1165          if (key == null || mappingFunction == null)
# Line 1624 | Line 1622 | public class ConcurrentHashMapV8<K, V>
1622              throws java.io.IOException, ClassNotFoundException {
1623          s.defaultReadObject();
1624          this.segments = null; // unneeded
1625 <        // initalize transient final field
1625 >        // initialize transient final field
1626          UNSAFE.putObjectVolatile(this, counterOffset, new LongAdder());
1627          this.targetCapacity = DEFAULT_CAPACITY;
1628  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines