--- jsr166/src/jsr166x/ConcurrentSkipListSet.java 2004/12/21 17:27:44 1.5
+++ jsr166/src/jsr166x/ConcurrentSkipListSet.java 2009/11/16 04:16:42 1.7
@@ -4,7 +4,7 @@
* http://creativecommons.org/licenses/publicdomain
*/
-package jsr166x;
+package jsr166x;
import java.util.*;
import java.util.concurrent.*;
@@ -24,7 +24,7 @@ import java.util.concurrent.*;
* threads. Iterators are weakly consistent, returning elements
* reflecting the state of the set at some point at or since the
* creation of the iterator. They do not throw {@link
- * ConcurrentModificationException}, and may procede concurrently with
+ * ConcurrentModificationException}, and may proceed concurrently with
* other operations.
*
*
Beware that, unlike in most collections, the size
@@ -60,11 +60,11 @@ public class ConcurrentSkipListSet
* fields of underlying map, but enables this field to be declared
* final, which is necessary for thread safety.
*/
- private final ConcurrentSkipListMap m;
+ private final ConcurrentSkipListMap m;
/**
* Constructs a new, empty set, sorted according to the elements' natural
- * order.
+ * order.
*/
public ConcurrentSkipListSet() {
m = new ConcurrentSkipListMap();
@@ -72,7 +72,7 @@ public class ConcurrentSkipListSet
/**
* Constructs a new, empty set, sorted according to the specified
- * comparator.
+ * comparator.
*
* @param c the comparator that will be used to sort this set. A
* null value indicates that the elements' natural
@@ -259,7 +259,7 @@ public class ConcurrentSkipListSet
return false;
}
}
-
+
/**
* Removes from this set all of its elements that are contained in
* the specified collection. If the specified collection is also
@@ -269,7 +269,7 @@ public class ConcurrentSkipListSet
* @param c collection that defines which elements will be removed from
* this set.
* @return true if this set changed as a result of the call.
- *
+ *
* @throws ClassCastException if the types of one or more elements in this
* set are incompatible with the specified collection
* @throws NullPointerException if the specified collection, or any
@@ -283,13 +283,13 @@ public class ConcurrentSkipListSet
modified = true;
return modified;
}
-
+
/* ---------------- Relational operations -------------- */
/**
* Returns an element greater than or equal to the given element, or
* null if there is no such element.
- *
+ *
* @param o the value to match
* @return an element greater than or equal to given element, or
* null if there is no such element.
@@ -304,7 +304,7 @@ public class ConcurrentSkipListSet
/**
* Returns an element strictly less than the given element, or
* null if there is no such element.
- *
+ *
* @param o the value to match
* @return the greatest element less than the given element, or
* null if there is no such element.
@@ -319,7 +319,7 @@ public class ConcurrentSkipListSet
/**
* Returns an element less than or equal to the given element, or
* null if there is no such element.
- *
+ *
* @param o the value to match
* @return the greatest element less than or equal to given
* element, or null if there is no such element.
@@ -334,7 +334,7 @@ public class ConcurrentSkipListSet
/**
* Returns an element strictly greater than the given element, or
* null if there is no such element.
- *
+ *
* @param o the value to match
* @return the least element greater than the given element, or
* null if there is no such element.
@@ -407,7 +407,7 @@ public class ConcurrentSkipListSet
* fromElement and toElement are equal, the returned
* sorted set is empty.) The returned sorted set is backed by this set,
* so changes in the returned sorted set are reflected in this set, and
- * vice-versa.
+ * vice-versa.
* @param fromElement low endpoint (inclusive) of the subSet.
* @param toElement high endpoint (exclusive) of the subSet.
* @return a view of the portion of this set whose elements range from
@@ -430,7 +430,7 @@ public class ConcurrentSkipListSet
* Returns a view of the portion of this set whose elements are strictly
* less than toElement. The returned sorted set is backed by
* this set, so changes in the returned sorted set are reflected in this
- * set, and vice-versa.
+ * set, and vice-versa.
* @param toElement high endpoint (exclusive) of the headSet.
* @return a view of the portion of this set whose elements are strictly
* less than toElement.
@@ -473,23 +473,23 @@ public class ConcurrentSkipListSet
* tailSet methods of their underlying sets.
*
*/
- static class ConcurrentSkipListSubSet
- extends AbstractSet
+ static class ConcurrentSkipListSubSet
+ extends AbstractSet
implements NavigableSet, java.io.Serializable {
private static final long serialVersionUID = -7647078645896651609L;
/** The underlying submap */
private final ConcurrentSkipListMap.ConcurrentSkipListSubMap s;
-
+
/**
- * Creates a new submap.
+ * Creates a new submap.
* @param fromElement inclusive least value, or null if from start
* @param toElement exclusive upper bound or null if to end
* @throws IllegalArgumentException if fromElement and toElement
* nonnull and fromElement greater than toElement
*/
- ConcurrentSkipListSubSet(ConcurrentSkipListMap map,
+ ConcurrentSkipListSubSet(ConcurrentSkipListMap map,
E fromElement, E toElement) {
s = new ConcurrentSkipListMap.ConcurrentSkipListSubMap
(map, fromElement, toElement);
@@ -500,7 +500,7 @@ public class ConcurrentSkipListSet
public NavigableSet subSet(E fromElement, E toElement) {
if (!s.inOpenRange(fromElement) || !s.inOpenRange(toElement))
throw new IllegalArgumentException("element out of range");
- return new ConcurrentSkipListSubSet(s.getMap(),
+ return new ConcurrentSkipListSubSet(s.getMap(),
fromElement, toElement);
}
@@ -508,15 +508,15 @@ public class ConcurrentSkipListSet
E least = s.getLeast();
if (!s.inOpenRange(toElement))
throw new IllegalArgumentException("element out of range");
- return new ConcurrentSkipListSubSet(s.getMap(),
+ return new ConcurrentSkipListSubSet(s.getMap(),
least, toElement);
}
-
+
public NavigableSet tailSet(E fromElement) {
E fence = s.getFence();
if (!s.inOpenRange(fromElement))
throw new IllegalArgumentException("element out of range");
- return new ConcurrentSkipListSubSet(s.getMap(),
+ return new ConcurrentSkipListSubSet(s.getMap(),
fromElement, fence);
}
@@ -539,7 +539,7 @@ public class ConcurrentSkipListSet
public Iterator descendingIterator() {
return s.descendingKeySet().iterator();
}
- public E pollFirst() {
+ public E pollFirst() {
Map.Entry e = s.pollFirstEntry();
return (e == null)? null : e.getKey();
}
@@ -549,4 +549,4 @@ public class ConcurrentSkipListSet
}
}
-}
+}