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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentSkipListMap.java (file contents):
Revision 1.70 by jsr166, Wed Jun 1 20:06:22 2011 UTC vs.
Revision 1.71 by jsr166, Wed Jun 1 20:31:31 2011 UTC

# Line 323 | Line 323 | public class ConcurrentSkipListMap<K,V>
323      private transient int randomSeed;
324  
325      /** Lazily initialized key set */
326 <    private transient KeySet keySet;
326 >    private transient KeySet<K> keySet;
327      /** Lazily initialized entry set */
328 <    private transient EntrySet entrySet;
328 >    private transient EntrySet<K,V> entrySet;
329      /** Lazily initialized values collection */
330 <    private transient Values values;
330 >    private transient Values<V> values;
331      /** Lazily initialized descending key set */
332      private transient ConcurrentNavigableMap<K,V> descendingMap;
333  
# Line 488 | Line 488 | public class ConcurrentSkipListMap<K,V>
488          static {
489              try {
490                  UNSAFE = sun.misc.Unsafe.getUnsafe();
491 <                Class k = Node.class;
491 >                Class<Node> k = Node.class;
492                  valueOffset = UNSAFE.objectFieldOffset
493                      (k.getDeclaredField("value"));
494                  nextOffset = UNSAFE.objectFieldOffset
# Line 568 | Line 568 | public class ConcurrentSkipListMap<K,V>
568          static {
569              try {
570                  UNSAFE = sun.misc.Unsafe.getUnsafe();
571 <                Class k = Index.class;
571 >                Class<Index> k = Index.class;
572                  rightOffset = UNSAFE.objectFieldOffset
573                      (k.getDeclaredField("right"));
574              } catch (Exception e) {
# Line 1726 | Line 1726 | public class ConcurrentSkipListMap<K,V>
1726       * @return a navigable set view of the keys in this map
1727       */
1728      public NavigableSet<K> keySet() {
1729 <        KeySet ks = keySet;
1730 <        return (ks != null) ? ks : (keySet = new KeySet(this));
1729 >        KeySet<K> ks = keySet;
1730 >        return (ks != null) ? ks : (keySet = new KeySet<K>(this));
1731      }
1732  
1733      public NavigableSet<K> navigableKeySet() {
1734 <        KeySet ks = keySet;
1735 <        return (ks != null) ? ks : (keySet = new KeySet(this));
1734 >        KeySet<K> ks = keySet;
1735 >        return (ks != null) ? ks : (keySet = new KeySet<K>(this));
1736      }
1737  
1738      /**
# Line 1754 | Line 1754 | public class ConcurrentSkipListMap<K,V>
1754       * reflect any modifications subsequent to construction.
1755       */
1756      public Collection<V> values() {
1757 <        Values vs = values;
1758 <        return (vs != null) ? vs : (values = new Values(this));
1757 >        Values<V> vs = values;
1758 >        return (vs != null) ? vs : (values = new Values<V>(this));
1759      }
1760  
1761      /**
# Line 1783 | Line 1783 | public class ConcurrentSkipListMap<K,V>
1783       *         sorted in ascending key order
1784       */
1785      public Set<Map.Entry<K,V>> entrySet() {
1786 <        EntrySet es = entrySet;
1787 <        return (es != null) ? es : (entrySet = new EntrySet(this));
1786 >        EntrySet<K,V> es = entrySet;
1787 >        return (es != null) ? es : (entrySet = new EntrySet<K,V>(this));
1788      }
1789  
1790      public ConcurrentNavigableMap<K,V> descendingMap() {
# Line 2275 | Line 2275 | public class ConcurrentSkipListMap<K,V>
2275  
2276      static final class KeySet<E>
2277              extends AbstractSet<E> implements NavigableSet<E> {
2278 <        private final ConcurrentNavigableMap<E,Object> m;
2279 <        KeySet(ConcurrentNavigableMap<E,Object> map) { m = map; }
2278 >        private final ConcurrentNavigableMap<E,?> m;
2279 >        KeySet(ConcurrentNavigableMap<E,?> map) { m = map; }
2280          public int size() { return m.size(); }
2281          public boolean isEmpty() { return m.isEmpty(); }
2282          public boolean contains(Object o) { return m.containsKey(o); }
# Line 2290 | Line 2290 | public class ConcurrentSkipListMap<K,V>
2290          public E first() { return m.firstKey(); }
2291          public E last() { return m.lastKey(); }
2292          public E pollFirst() {
2293 <            Map.Entry<E,Object> e = m.pollFirstEntry();
2293 >            Map.Entry<E,?> e = m.pollFirstEntry();
2294              return (e == null) ? null : e.getKey();
2295          }
2296          public E pollLast() {
2297 <            Map.Entry<E,Object> e = m.pollLastEntry();
2297 >            Map.Entry<E,?> e = m.pollLastEntry();
2298              return (e == null) ? null : e.getKey();
2299          }
2300          public Iterator<E> iterator() {
# Line 2345 | Line 2345 | public class ConcurrentSkipListMap<K,V>
2345              return tailSet(fromElement, true);
2346          }
2347          public NavigableSet<E> descendingSet() {
2348 <            return new KeySet(m.descendingMap());
2348 >            return new KeySet<E>(m.descendingMap());
2349          }
2350      }
2351  
2352      static final class Values<E> extends AbstractCollection<E> {
2353 <        private final ConcurrentNavigableMap<Object, E> m;
2354 <        Values(ConcurrentNavigableMap<Object, E> map) {
2353 >        private final ConcurrentNavigableMap<?, E> m;
2354 >        Values(ConcurrentNavigableMap<?, E> map) {
2355              m = map;
2356          }
2357          public Iterator<E> iterator() {
2358              if (m instanceof ConcurrentSkipListMap)
2359 <                return ((ConcurrentSkipListMap<Object,E>)m).valueIterator();
2359 >                return ((ConcurrentSkipListMap<?,E>)m).valueIterator();
2360              else
2361 <                return ((SubMap<Object,E>)m).valueIterator();
2361 >                return ((SubMap<?,E>)m).valueIterator();
2362          }
2363          public boolean isEmpty() {
2364              return m.isEmpty();
# Line 2931 | Line 2931 | public class ConcurrentSkipListMap<K,V>
2931  
2932          public NavigableSet<K> keySet() {
2933              KeySet<K> ks = keySetView;
2934 <            return (ks != null) ? ks : (keySetView = new KeySet(this));
2934 >            return (ks != null) ? ks : (keySetView = new KeySet<K>(this));
2935          }
2936  
2937          public NavigableSet<K> navigableKeySet() {
2938              KeySet<K> ks = keySetView;
2939 <            return (ks != null) ? ks : (keySetView = new KeySet(this));
2939 >            return (ks != null) ? ks : (keySetView = new KeySet<K>(this));
2940          }
2941  
2942          public Collection<V> values() {
2943              Collection<V> vs = valuesView;
2944 <            return (vs != null) ? vs : (valuesView = new Values(this));
2944 >            return (vs != null) ? vs : (valuesView = new Values<V>(this));
2945          }
2946  
2947          public Set<Map.Entry<K,V>> entrySet() {
2948              Set<Map.Entry<K,V>> es = entrySetView;
2949 <            return (es != null) ? es : (entrySetView = new EntrySet(this));
2949 >            return (es != null) ? es : (entrySetView = new EntrySet<K,V>(this));
2950          }
2951  
2952          public NavigableSet<K> descendingKeySet() {
# Line 3080 | Line 3080 | public class ConcurrentSkipListMap<K,V>
3080      static {
3081          try {
3082              UNSAFE = sun.misc.Unsafe.getUnsafe();
3083 <            Class k = ConcurrentSkipListMap.class;
3083 >            Class<ConcurrentSkipListMap> k = ConcurrentSkipListMap.class;
3084              headOffset = UNSAFE.objectFieldOffset
3085                  (k.getDeclaredField("head"));
3086          } catch (Exception e) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines