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.98 by jsr166, Mon Feb 11 20:52:00 2013 UTC vs.
Revision 1.99 by jsr166, Fri Feb 15 22:20:46 2013 UTC

# Line 212 | Line 212 | import java.io.Serializable;
212   * @param <K> the type of keys maintained by this map
213   * @param <V> the type of mapped values
214   */
215 < public class ConcurrentHashMapV8<K, V>
216 <    implements ConcurrentMap<K, V>, Serializable {
215 > public class ConcurrentHashMapV8<K,V>
216 >    implements ConcurrentMap<K,V>, Serializable {
217      private static final long serialVersionUID = 7249069246763182397L;
218  
219      /**
# Line 2279 | Line 2279 | public class ConcurrentHashMapV8<K, V>
2279       */
2280      @SuppressWarnings("serial") static class Traverser<K,V,R>
2281          extends CountedCompleter<R> {
2282 <        final ConcurrentHashMapV8<K, V> map;
2282 >        final ConcurrentHashMapV8<K,V> map;
2283          Node<V> next;        // the next entry to use
2284          Object nextKey;      // cached key field of next
2285          V nextVal;           // cached val field of next
# Line 2291 | Line 2291 | public class ConcurrentHashMapV8<K, V>
2291          int batch;           // split control
2292  
2293          /** Creates iterator for all entries in the table. */
2294 <        Traverser(ConcurrentHashMapV8<K, V> map) {
2294 >        Traverser(ConcurrentHashMapV8<K,V> map) {
2295              this.map = map;
2296          }
2297  
# Line 2323 | Line 2323 | public class ConcurrentHashMapV8<K, V>
2323                  if (e != null)                  // advance past used/skipped node
2324                      e = e.next;
2325                  while (e == null) {             // get to next non-null bin
2326 <                    ConcurrentHashMapV8<K, V> m;
2326 >                    ConcurrentHashMapV8<K,V> m;
2327                      Node<V>[] t; int b, i, n; Object ek; //  must use locals
2328                      if ((t = tab) != null)
2329                          n = t.length;
# Line 2376 | Line 2376 | public class ConcurrentHashMapV8<K, V>
2376           * anyway.
2377           */
2378          final int preSplit() {
2379 <            ConcurrentHashMapV8<K, V> m; int b; Node<V>[] t;  ForkJoinPool pool;
2379 >            ConcurrentHashMapV8<K,V> m; int b; Node<V>[] t;  ForkJoinPool pool;
2380              if ((b = batch) < 0 && (m = map) != null) { // force initialization
2381                  if ((t = tab) == null && (t = tab = m.table) != null)
2382                      baseLimit = baseSize = t.length;
# Line 2687 | Line 2687 | public class ConcurrentHashMapV8<K, V>
2687       * memoized result, as in:
2688       *
2689       *  <pre> {@code
2690 <     * map.computeIfAbsent(key, new Fun<K, V>() {
2690 >     * map.computeIfAbsent(key, new Fun<K,V>() {
2691       *   public V map(K k) { return new Value(f(k)); }});}</pre>
2692       *
2693       * @param key key with which the specified value is to be associated
# Line 3068 | Line 3068 | public class ConcurrentHashMapV8<K, V>
3068      @SuppressWarnings("serial") static final class KeyIterator<K,V>
3069          extends Traverser<K,V,Object>
3070          implements Spliterator<K>, Enumeration<K> {
3071 <        KeyIterator(ConcurrentHashMapV8<K, V> map) { super(map); }
3072 <        KeyIterator(ConcurrentHashMapV8<K, V> map, Traverser<K,V,Object> it) {
3071 >        KeyIterator(ConcurrentHashMapV8<K,V> map) { super(map); }
3072 >        KeyIterator(ConcurrentHashMapV8<K,V> map, Traverser<K,V,Object> it) {
3073              super(map, it, -1);
3074          }
3075          public KeyIterator<K,V> split() {
# Line 3091 | Line 3091 | public class ConcurrentHashMapV8<K, V>
3091      @SuppressWarnings("serial") static final class ValueIterator<K,V>
3092          extends Traverser<K,V,Object>
3093          implements Spliterator<V>, Enumeration<V> {
3094 <        ValueIterator(ConcurrentHashMapV8<K, V> map) { super(map); }
3095 <        ValueIterator(ConcurrentHashMapV8<K, V> map, Traverser<K,V,Object> it) {
3094 >        ValueIterator(ConcurrentHashMapV8<K,V> map) { super(map); }
3095 >        ValueIterator(ConcurrentHashMapV8<K,V> map, Traverser<K,V,Object> it) {
3096              super(map, it, -1);
3097          }
3098          public ValueIterator<K,V> split() {
# Line 3115 | Line 3115 | public class ConcurrentHashMapV8<K, V>
3115      @SuppressWarnings("serial") static final class EntryIterator<K,V>
3116          extends Traverser<K,V,Object>
3117          implements Spliterator<Map.Entry<K,V>> {
3118 <        EntryIterator(ConcurrentHashMapV8<K, V> map) { super(map); }
3119 <        EntryIterator(ConcurrentHashMapV8<K, V> map, Traverser<K,V,Object> it) {
3118 >        EntryIterator(ConcurrentHashMapV8<K,V> map) { super(map); }
3119 >        EntryIterator(ConcurrentHashMapV8<K,V> map, Traverser<K,V,Object> it) {
3120              super(map, it, -1);
3121          }
3122          public EntryIterator<K,V> split() {
# Line 3138 | Line 3138 | public class ConcurrentHashMapV8<K, V>
3138      /**
3139       * Exported Entry for iterators
3140       */
3141 <    static final class MapEntry<K,V> implements Map.Entry<K, V> {
3141 >    static final class MapEntry<K,V> implements Map.Entry<K,V> {
3142          final K key; // non-null
3143          V val;       // non-null
3144 <        final ConcurrentHashMapV8<K, V> map;
3145 <        MapEntry(K key, V val, ConcurrentHashMapV8<K, V> map) {
3144 >        final ConcurrentHashMapV8<K,V> map;
3145 >        MapEntry(K key, V val, ConcurrentHashMapV8<K,V> map) {
3146              this.key = key;
3147              this.val = val;
3148              this.map = map;
# Line 4578 | Line 4578 | public class ConcurrentHashMapV8<K, V>
4578      /**
4579       * Base class for views.
4580       */
4581 <    abstract static class CHMView<K, V> {
4582 <        final ConcurrentHashMapV8<K, V> map;
4583 <        CHMView(ConcurrentHashMapV8<K, V> map)  { this.map = map; }
4581 >    abstract static class CHMView<K,V> {
4582 >        final ConcurrentHashMapV8<K,V> map;
4583 >        CHMView(ConcurrentHashMapV8<K,V> map)  { this.map = map; }
4584  
4585          /**
4586           * Returns the map backing this view.
# Line 4722 | Line 4722 | public class ConcurrentHashMapV8<K, V>
4722          implements Set<K>, java.io.Serializable {
4723          private static final long serialVersionUID = 7249069246763182397L;
4724          private final V value;
4725 <        KeySetView(ConcurrentHashMapV8<K, V> map, V value) {  // non-public
4725 >        KeySetView(ConcurrentHashMapV8<K,V> map, V value) {  // non-public
4726              super(map);
4727              this.value = value;
4728          }
# Line 4790 | Line 4790 | public class ConcurrentHashMapV8<K, V>
4790       */
4791      public static final class ValuesView<K,V> extends CHMView<K,V>
4792          implements Collection<V> {
4793 <        ValuesView(ConcurrentHashMapV8<K, V> map)   { super(map); }
4793 >        ValuesView(ConcurrentHashMapV8<K,V> map)   { super(map); }
4794          public final boolean contains(Object o) { return map.containsValue(o); }
4795          public final boolean remove(Object o) {
4796              if (o != null) {
# Line 4834 | Line 4834 | public class ConcurrentHashMapV8<K, V>
4834       */
4835      public static final class EntrySetView<K,V> extends CHMView<K,V>
4836          implements Set<Map.Entry<K,V>> {
4837 <        EntrySetView(ConcurrentHashMapV8<K, V> map) { super(map); }
4837 >        EntrySetView(ConcurrentHashMapV8<K,V> map) { super(map); }
4838          public final boolean contains(Object o) {
4839              Object k, v, r; Map.Entry<?,?> e;
4840              return ((o instanceof Map.Entry) &&

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines