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

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

# Line 119 | Line 119 | public class ConcurrentSkipListSet<E>
119       */
120      public Object clone() {
121          ConcurrentSkipListSet<E> clone = null;
122 <        try {
123 <            clone = (ConcurrentSkipListSet<E>) super.clone();
124 <        } catch (CloneNotSupportedException e) {
125 <            throw new InternalError();
126 <        }
122 >        try {
123 >            clone = (ConcurrentSkipListSet<E>) super.clone();
124 >        } catch (CloneNotSupportedException e) {
125 >            throw new InternalError();
126 >        }
127  
128          clone.m.initialize();
129          clone.addAll(this);
# Line 149 | Line 149 | public class ConcurrentSkipListSet<E>
149       * @return  the number of elements in this set.
150       */
151      public int size() {
152 <        return m.size();
152 >        return m.size();
153      }
154  
155      /**
# Line 157 | Line 157 | public class ConcurrentSkipListSet<E>
157       * @return <tt>true</tt> if this set contains no elements.
158       */
159      public boolean isEmpty() {
160 <        return m.isEmpty();
160 >        return m.isEmpty();
161      }
162  
163      /**
# Line 167 | Line 167 | public class ConcurrentSkipListSet<E>
167       * @return <tt>true</tt> if this set contains the specified element.
168       *
169       * @throws ClassCastException if the specified object cannot be compared
170 <     *            with the elements currently in the set.
170 >     *            with the elements currently in the set.
171       * @throws NullPointerException if o is <tt>null</tt>.
172       */
173      public boolean contains(Object o) {
174 <        return m.containsKey(o);
174 >        return m.containsKey(o);
175      }
176  
177      /**
# Line 182 | Line 182 | public class ConcurrentSkipListSet<E>
182       *         element.
183       *
184       * @throws ClassCastException if the specified object cannot be compared
185 <     *            with the elements currently in the set.
185 >     *            with the elements currently in the set.
186       * @throws NullPointerException if o is <tt>null</tt>.
187       */
188      public boolean add(E o) {
189 <        return m.putIfAbsent(o, Boolean.TRUE) == null;
189 >        return m.putIfAbsent(o, Boolean.TRUE) == null;
190      }
191  
192      /**
# Line 196 | Line 196 | public class ConcurrentSkipListSet<E>
196       * @return <tt>true</tt> if the set contained the specified element.
197       *
198       * @throws ClassCastException if the specified object cannot be compared
199 <     *            with the elements currently in the set.
199 >     *            with the elements currently in the set.
200       * @throws NullPointerException if o is <tt>null</tt>.
201       */
202      public boolean remove(Object o) {
203 <        return m.removep(o);
203 >        return m.removep(o);
204      }
205  
206      /**
207       * Removes all of the elements from this set.
208       */
209      public void clear() {
210 <        m.clear();
210 >        m.clear();
211      }
212  
213      /**
# Line 217 | Line 217 | public class ConcurrentSkipListSet<E>
217       * @return an iterator over the elements in this set.
218       */
219      public Iterator<E> iterator() {
220 <        return m.keyIterator();
220 >        return m.keyIterator();
221      }
222  
223      /**
# Line 227 | Line 227 | public class ConcurrentSkipListSet<E>
227       * @return an iterator over the elements in this set.
228       */
229      public Iterator<E> descendingIterator() {
230 <        return m.descendingKeyIterator();
230 >        return m.descendingKeyIterator();
231      }
232  
233      /* ---------------- AbstractSet Overrides -------------- */
# Line 246 | Line 246 | public class ConcurrentSkipListSet<E>
246       */
247      public boolean equals(Object o) {
248          // Override AbstractSet version to avoid calling size()
249 <        if (o == this)
250 <            return true;
251 <        if (!(o instanceof Set))
252 <            return false;
253 <        Collection c = (Collection) o;
249 >        if (o == this)
250 >            return true;
251 >        if (!(o instanceof Set))
252 >            return false;
253 >        Collection c = (Collection) o;
254          try {
255              return containsAll(c) && c.containsAll(this);
256          } catch(ClassCastException unused)   {
# Line 411 | Line 411 | public class ConcurrentSkipListSet<E>
411       * @param fromElement low endpoint (inclusive) of the subSet.
412       * @param toElement high endpoint (exclusive) of the subSet.
413       * @return a view of the portion of this set whose elements range from
414 <     *         <tt>fromElement</tt>, inclusive, to <tt>toElement</tt>,
415 <     *         exclusive.
414 >     *         <tt>fromElement</tt>, inclusive, to <tt>toElement</tt>,
415 >     *         exclusive.
416       * @throws ClassCastException if <tt>fromElement</tt> and
417       *         <tt>toElement</tt> cannot be compared to one another using
418       *         this set's comparator (or, if the set has no comparator,
# Line 420 | Line 420 | public class ConcurrentSkipListSet<E>
420       * @throws IllegalArgumentException if <tt>fromElement</tt> is
421       * greater than <tt>toElement</tt>.
422       * @throws NullPointerException if <tt>fromElement</tt> or
423 <     *         <tt>toElement</tt> is <tt>null</tt>.
423 >     *         <tt>toElement</tt> is <tt>null</tt>.
424       */
425      public NavigableSet<E> subSet(E fromElement, E toElement) {
426 <        return new ConcurrentSkipListSubSet<E>(m, fromElement, toElement);
426 >        return new ConcurrentSkipListSubSet<E>(m, fromElement, toElement);
427      }
428  
429      /**
# Line 433 | Line 433 | public class ConcurrentSkipListSet<E>
433       * set, and vice-versa.
434       * @param toElement high endpoint (exclusive) of the headSet.
435       * @return a view of the portion of this set whose elements are strictly
436 <     *         less than toElement.
436 >     *         less than toElement.
437       * @throws ClassCastException if <tt>toElement</tt> is not compatible
438       *         with this set's comparator (or, if the set has no comparator,
439       *         if <tt>toElement</tt> does not implement <tt>Comparable</tt>).
440       * @throws NullPointerException if <tt>toElement</tt> is <tt>null</tt>.
441       */
442      public NavigableSet<E> headSet(E toElement) {
443 <        return new ConcurrentSkipListSubSet<E>(m, null, toElement);
443 >        return new ConcurrentSkipListSubSet<E>(m, null, toElement);
444      }
445  
446  
# Line 459 | Line 459 | public class ConcurrentSkipListSet<E>
459       * @throws NullPointerException if <tt>fromElement</tt> is <tt>null</tt>.
460       */
461      public NavigableSet<E> tailSet(E fromElement) {
462 <        return new ConcurrentSkipListSubSet<E>(m, fromElement, null);
462 >        return new ConcurrentSkipListSubSet<E>(m, fromElement, null);
463      }
464  
465      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines