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

Comparing jsr166/src/jsr166x/ConcurrentSkipListMap.java (file contents):
Revision 1.8 by jsr166, Mon Nov 16 04:16:42 2009 UTC vs.
Revision 1.9 by jsr166, Tue Nov 24 03:57:04 2009 UTC

# Line 583 | Line 583 | public class ConcurrentSkipListMap<K,V>
583       * support the <tt>Map.Entry.setValue</tt> method.
584       */
585      static class SnapshotEntry<K,V> implements Map.Entry<K,V> {
586 <        private final K key;
587 <        private final V value;
586 >        private final K key;
587 >        private final V value;
588  
589          /**
590           * Creates a new entry representing the given key and value.
# Line 592 | Line 592 | public class ConcurrentSkipListMap<K,V>
592           * @param value the value
593           */
594          SnapshotEntry(K key, V value) {
595 <            this.key = key;
596 <            this.value = value;
597 <        }
598 <
599 <        /**
600 <         * Returns the key corresponding to this entry.
601 <         *
602 <         * @return the key corresponding to this entry.
603 <         */
595 >            this.key = key;
596 >            this.value = value;
597 >        }
598 >
599 >        /**
600 >         * Returns the key corresponding to this entry.
601 >         *
602 >         * @return the key corresponding to this entry.
603 >         */
604          public K getKey() {
605              return key;
606          }
607  
608 <        /**
609 <         * Returns the value corresponding to this entry.
610 <         *
611 <         * @return the value corresponding to this entry.
612 <         */
608 >        /**
609 >         * Returns the value corresponding to this entry.
610 >         *
611 >         * @return the value corresponding to this entry.
612 >         */
613          public V getValue() {
614 <            return value;
614 >            return value;
615          }
616  
617 <        /**
618 <         * Always fails, throwing <tt>UnsupportedOperationException</tt>.
619 <         * @throws UnsupportedOperationException always.
617 >        /**
618 >         * Always fails, throwing <tt>UnsupportedOperationException</tt>.
619 >         * @throws UnsupportedOperationException always.
620           */
621          public V setValue(V value) {
622              throw new UnsupportedOperationException();
# Line 649 | Line 649 | public class ConcurrentSkipListMap<K,V>
649           * @return a String representation of this entry.
650           */
651          public String toString() {
652 <            return getKey() + "=" + getValue();
652 >            return getKey() + "=" + getValue();
653          }
654      }
655  
# Line 1847 | Line 1847 | public class ConcurrentSkipListMap<K,V>
1847       *
1848       * @param value value whose presence in this Map is to be tested.
1849       * @return  <tt>true</tt> if a mapping to <tt>value</tt> exists;
1850 <     *          <tt>false</tt> otherwise.
1850 >     *          <tt>false</tt> otherwise.
1851       * @throws  NullPointerException  if the value is <tt>null</tt>.
1852       */
1853      public boolean containsValue(Object value) {
# Line 2056 | Line 2056 | public class ConcurrentSkipListMap<K,V>
2056       * @return <tt>true</tt> if the specified object is equal to this map.
2057       */
2058      public boolean equals(Object o) {
2059 <        if (o == this)
2060 <            return true;
2061 <        if (!(o instanceof Map))
2062 <            return false;
2063 <        Map<K,V> t = (Map<K,V>) o;
2059 >        if (o == this)
2060 >            return true;
2061 >        if (!(o instanceof Map))
2062 >            return false;
2063 >        Map<K,V> t = (Map<K,V>) o;
2064          try {
2065              return (containsAllMappings(this, t) &&
2066                      containsAllMappings(t, this));
# Line 2525 | Line 2525 | public class ConcurrentSkipListMap<K,V>
2525          Node<K,V> last;
2526          /** the next node to return from next(); */
2527          Node<K,V> next;
2528 <        /** Cache of next value field to maintain weak consistency */
2529 <        Object nextValue;
2528 >        /** Cache of next value field to maintain weak consistency */
2529 >        Object nextValue;
2530  
2531          Iter() {}
2532  
# Line 2537 | Line 2537 | public class ConcurrentSkipListMap<K,V>
2537          /** initialize ascending iterator for entire range  */
2538          final void initAscending() {
2539              for (;;) {
2540 <                next = findFirst();
2540 >                next = findFirst();
2541                  if (next == null)
2542                      break;
2543                  nextValue = next.value;
# Line 2553 | Line 2553 | public class ConcurrentSkipListMap<K,V>
2553           */
2554          final void initAscending(K least, K fence) {
2555              for (;;) {
2556 <                next = findCeiling(least);
2556 >                next = findCeiling(least);
2557                  if (next == null)
2558                      break;
2559                  nextValue = next.value;
# Line 2571 | Line 2571 | public class ConcurrentSkipListMap<K,V>
2571              if ((last = next) == null)
2572                  throw new NoSuchElementException();
2573              for (;;) {
2574 <                next = next.next;
2574 >                next = next.next;
2575                  if (next == null)
2576                      break;
2577                  nextValue = next.value;
# Line 2587 | Line 2587 | public class ConcurrentSkipListMap<K,V>
2587              if ((last = next) == null)
2588                  throw new NoSuchElementException();
2589              for (;;) {
2590 <                next = next.next;
2590 >                next = next.next;
2591                  if (next == null)
2592                      break;
2593                  nextValue = next.value;
# Line 2604 | Line 2604 | public class ConcurrentSkipListMap<K,V>
2604          /** initialize descending iterator for entire range  */
2605          final void initDescending() {
2606              for (;;) {
2607 <                next = findLast();
2607 >                next = findLast();
2608                  if (next == null)
2609                      break;
2610                  nextValue = next.value;
# Line 2621 | Line 2621 | public class ConcurrentSkipListMap<K,V>
2621           */
2622          final void initDescending(K least, K fence) {
2623              for (;;) {
2624 <                next = findLower(fence);
2624 >                next = findLower(fence);
2625                  if (next == null)
2626                      break;
2627                  nextValue = next.value;
# Line 2641 | Line 2641 | public class ConcurrentSkipListMap<K,V>
2641                  throw new NoSuchElementException();
2642              K k = last.key;
2643              for (;;) {
2644 <                next = findNear(k, LT);
2644 >                next = findNear(k, LT);
2645                  if (next == null)
2646                      break;
2647                  nextValue = next.value;
# Line 2658 | Line 2658 | public class ConcurrentSkipListMap<K,V>
2658                  throw new NoSuchElementException();
2659              K k = last.key;
2660              for (;;) {
2661 <                next = findNear(k, LT);
2661 >                next = findNear(k, LT);
2662                  if (next == null)
2663                      break;
2664                  nextValue = next.value;
# Line 2781 | Line 2781 | public class ConcurrentSkipListMap<K,V>
2781              Object v = lastValue;
2782              if (last == null || v == null)
2783                  throw new IllegalStateException();
2784 <            return (V)v;
2784 >            return (V)v;
2785          }
2786  
2787          public V setValue(V value) {
# Line 2810 | Line 2810 | public class ConcurrentSkipListMap<K,V>
2810              // If not acting as entry, just use default.
2811              if (last == null)
2812                  return super.toString();
2813 <            return getKey() + "=" + getValue();
2813 >            return getKey() + "=" + getValue();
2814          }
2815      }
2816  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines