--- jsr166/src/jsr166x/ConcurrentSkipListSet.java 2012/12/30 00:05:22 1.16
+++ jsr166/src/jsr166x/ConcurrentSkipListSet.java 2013/01/16 00:53:17 1.18
@@ -18,7 +18,7 @@ import java.util.concurrent.*;
* used.
*
*
This implementation provides expected average log(n) time
- * cost for the contains, add, and remove
+ * cost for the {@code contains}, {@code add}, and {@code remove}
* operations and their variants. Insertion, removal, and access
* operations safely execute concurrently by multiple
* threads. Iterators are weakly consistent, returning elements
@@ -27,21 +27,21 @@ import java.util.concurrent.*;
* ConcurrentModificationException}, and may proceed concurrently with
* other operations.
*
- *
Beware that, unlike in most collections, the size
+ *
Beware that, unlike in most collections, the {@code size}
* method is not a constant-time operation. Because of the
* asynchronous nature of these sets, determining the current number
* of elements requires a traversal of the elements. Additionally, the
- * bulk operations addAll, removeAll,
- * <retainAll, and tt>containsAll are not
+ * bulk operations {@code addAll}, {@code removeAll},
+ * {@code retainAll}, and {@code containsAll} are not
* guaranteed to be performed atomically. For example, an iterator
- * operating concurrently with an addAll operation might view
+ * operating concurrently with an {@code addAll} operation might view
* only some of the added elements.
*
*
This class and its iterators implement all of the
* optional methods of the {@link Set} and {@link Iterator}
* interfaces. Like most other concurrent collection implementations,
- * this class does not permit the use of null elements.
- * because null arguments and return values cannot be reliably
+ * this class does not permit the use of {@code null} elements.
+ * because {@code null} arguments and return values cannot be reliably
* distinguished from the absence of elements.
*
* @author Doug Lea
@@ -75,7 +75,7 @@ public class ConcurrentSkipListSet
* comparator.
*
* @param c the comparator that will be used to sort this set. A
- * null value indicates that the elements' natural
+ * {@code null} value indicates that the elements' natural
* ordering should be used.
*/
public ConcurrentSkipListSet(Comparator super E> c) {
@@ -91,7 +91,7 @@ public class ConcurrentSkipListSet
* @throws ClassCastException if the elements in the specified
* collection are not comparable, or are not mutually comparable
* @throws NullPointerException if the specified collection is
- * null
+ * {@code null}
*/
public ConcurrentSkipListSet(Collection extends E> c) {
m = new ConcurrentSkipListMap();
@@ -104,7 +104,7 @@ public class ConcurrentSkipListSet
*
* @param s sorted set whose elements will comprise the new set
* @throws NullPointerException if the specified sorted set is
- * null
+ * {@code null}
*/
public ConcurrentSkipListSet(SortedSet s) {
m = new ConcurrentSkipListMap(s.comparator());
@@ -134,8 +134,8 @@ public class ConcurrentSkipListSet
/**
* Returns the number of elements in this set. If this set
- * contains more than Integer.MAX_VALUE elements, it
- * returns Integer.MAX_VALUE.
+ * contains more than {@code Integer.MAX_VALUE} elements, it
+ * returns {@code Integer.MAX_VALUE}.
*
* Beware that, unlike in most collections, this method is
* NOT a constant-time operation. Because of the
@@ -153,22 +153,22 @@ public class ConcurrentSkipListSet
}
/**
- * Returns true if this set contains no elements.
- * @return true if this set contains no elements
+ * Returns {@code true} if this set contains no elements.
+ * @return {@code true} if this set contains no elements
*/
public boolean isEmpty() {
return m.isEmpty();
}
/**
- * Returns true if this set contains the specified element.
+ * Returns {@code true} if this set contains the specified element.
*
* @param o the object to be checked for containment in this set
- * @return true if this set contains the specified element
+ * @return {@code true} if this set contains the specified element
*
* @throws ClassCastException if the specified object cannot be compared
* with the elements currently in the set
- * @throws NullPointerException if o is null
+ * @throws NullPointerException if o is {@code null}
*/
public boolean contains(Object o) {
return m.containsKey(o);
@@ -178,12 +178,12 @@ public class ConcurrentSkipListSet
* Adds the specified element to this set if it is not already present.
*
* @param o element to be added to this set
- * @return true if the set did not already contain the specified
+ * @return {@code true} if the set did not already contain the specified
* element
*
* @throws ClassCastException if the specified object cannot be compared
* with the elements currently in the set
- * @throws NullPointerException if o is null
+ * @throws NullPointerException if o is {@code null}
*/
public boolean add(E o) {
return m.putIfAbsent(o, Boolean.TRUE) == null;
@@ -193,11 +193,11 @@ public class ConcurrentSkipListSet
* Removes the specified element from this set if it is present.
*
* @param o object to be removed from this set, if present
- * @return true if the set contained the specified element
+ * @return {@code true} if the set contained the specified element
*
* @throws ClassCastException if the specified object cannot be compared
* with the elements currently in the set
- * @throws NullPointerException if o is null
+ * @throws NullPointerException if o is {@code null}
*/
public boolean remove(Object o) {
return m.removep(o);
@@ -234,7 +234,7 @@ public class ConcurrentSkipListSet
/**
* Compares the specified object with this set for equality. Returns
- * true if the specified object is also a set, the two sets
+ * {@code true} if the specified object is also a set, the two sets
* have the same size, and every member of the specified set is
* contained in this set (or equivalently, every member of this set is
* contained in the specified set). This definition ensures that the
@@ -242,7 +242,7 @@ public class ConcurrentSkipListSet
* set interface.
*
* @param o Object to be compared for equality with this set
- * @return true if the specified Object is equal to this set
+ * @return {@code true} if the specified Object is equal to this set
*/
public boolean equals(Object o) {
// Override AbstractSet version to avoid calling size()
@@ -268,12 +268,12 @@ 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
+ * @return {@code 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
- * of its elements are null
+ * of its elements are {@code null}
*/
public boolean removeAll(Collection> c) {
// Override AbstractSet version to avoid unnecessary call to size()
@@ -288,14 +288,14 @@ public class ConcurrentSkipListSet
/**
* Returns an element greater than or equal to the given element, or
- * null if there is no such element.
+ * {@code 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
+ * {@code null} if there is no such element
* @throws ClassCastException if o cannot be compared with the elements
* currently in the set
- * @throws NullPointerException if o is null
+ * @throws NullPointerException if o is {@code null}
*/
public E ceiling(E o) {
return m.ceilingKey(o);
@@ -303,14 +303,14 @@ public class ConcurrentSkipListSet
/**
* Returns an element strictly less than the given element, or
- * null if there is no such element.
+ * {@code 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
+ * {@code null} if there is no such element
* @throws ClassCastException if o cannot be compared with the elements
* currently in the set
- * @throws NullPointerException if o is null
+ * @throws NullPointerException if o is {@code null}
*/
public E lower(E o) {
return m.lowerKey(o);
@@ -318,14 +318,14 @@ public class ConcurrentSkipListSet
/**
* Returns an element less than or equal to the given element, or
- * null if there is no such element.
+ * {@code 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
+ * element, or {@code null} if there is no such element
* @throws ClassCastException if o cannot be compared with the elements
* currently in the set
- * @throws NullPointerException if o is null
+ * @throws NullPointerException if o is {@code null}
*/
public E floor(E o) {
return m.floorKey(o);
@@ -333,14 +333,14 @@ public class ConcurrentSkipListSet
/**
* Returns an element strictly greater than the given element, or
- * null if there is no such element.
+ * {@code 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
+ * {@code null} if there is no such element
* @throws ClassCastException if o cannot be compared with the elements
* currently in the set
- * @throws NullPointerException if o is null
+ * @throws NullPointerException if o is {@code null}
*/
public E higher(E o) {
return m.higherKey(o);
@@ -349,7 +349,7 @@ public class ConcurrentSkipListSet
/**
* Retrieves and removes the first (lowest) element.
*
- * @return the least element, or null if empty
+ * @return the least element, or {@code null} if empty
*/
public E pollFirst() {
return m.pollFirstKey();
@@ -358,7 +358,7 @@ public class ConcurrentSkipListSet
/**
* Retrieves and removes the last (highest) element.
*
- * @return the last element, or null if empty
+ * @return the last element, or {@code null} if empty
*/
public E pollLast() {
return m.pollLastKey();
@@ -369,10 +369,10 @@ public class ConcurrentSkipListSet
/**
- * Returns the comparator used to order this set, or null
+ * Returns the comparator used to order this set, or {@code null}
* if this set uses its elements natural ordering.
*
- * @return the comparator used to order this set, or null
+ * @return the comparator used to order this set, or {@code null}
* if this set uses its elements natural ordering
*/
public Comparator super E> comparator() {
@@ -403,24 +403,24 @@ public class ConcurrentSkipListSet
/**
* Returns a view of the portion of this set whose elements range from
- * fromElement, inclusive, to toElement, exclusive. (If
- * fromElement and toElement are equal, the returned
+ * {@code fromElement}, inclusive, to {@code toElement}, exclusive. (If
+ * {@code fromElement} and {@code 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.
* @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
- * fromElement, inclusive, to toElement,
+ * {@code fromElement}, inclusive, to {@code toElement},
* exclusive
- * @throws ClassCastException if fromElement and
- * toElement cannot be compared to one another using
+ * @throws ClassCastException if {@code fromElement} and
+ * {@code toElement} cannot be compared to one another using
* this set's comparator (or, if the set has no comparator,
* using natural ordering)
- * @throws IllegalArgumentException if fromElement is
- * greater than toElement
- * @throws NullPointerException if fromElement or
- * toElement is null
+ * @throws IllegalArgumentException if {@code fromElement} is
+ * greater than {@code toElement}
+ * @throws NullPointerException if {@code fromElement} or
+ * {@code toElement} is {@code null}
*/
public NavigableSet subSet(E fromElement, E toElement) {
return new ConcurrentSkipListSubSet(m, fromElement, toElement);
@@ -428,16 +428,16 @@ 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
+ * less than {@code 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.
* @param toElement high endpoint (exclusive) of the headSet
* @return a view of the portion of this set whose elements are strictly
* less than toElement
- * @throws ClassCastException if toElement is not compatible
+ * @throws ClassCastException if {@code toElement} is not compatible
* with this set's comparator (or, if the set has no comparator,
- * if toElement does not implement Comparable)
- * @throws NullPointerException if toElement is null
+ * if {@code toElement} does not implement {@code Comparable})
+ * @throws NullPointerException if {@code toElement} is {@code null}
*/
public NavigableSet headSet(E toElement) {
return new ConcurrentSkipListSubSet(m, null, toElement);
@@ -446,17 +446,17 @@ public class ConcurrentSkipListSet
/**
* Returns a view of the portion of this set whose elements are
- * greater than or equal to fromElement. The returned
+ * greater than or equal to {@code fromElement}. The returned
* sorted set is backed by this set, so changes in the returned
* sorted set are reflected in this set, and vice-versa.
* @param fromElement low endpoint (inclusive) of the tailSet
* @return a view of the portion of this set whose elements are
- * greater than or equal to fromElement
- * @throws ClassCastException if fromElement is not
+ * greater than or equal to {@code fromElement}
+ * @throws ClassCastException if {@code fromElement} is not
* compatible with this set's comparator (or, if the set has no
- * comparator, if fromElement does not implement
- * Comparable)
- * @throws NullPointerException if fromElement is null
+ * comparator, if {@code fromElement} does not implement
+ * {@code Comparable})
+ * @throws NullPointerException if {@code fromElement} is {@code null}
*/
public NavigableSet tailSet(E fromElement) {
return new ConcurrentSkipListSubSet(m, fromElement, null);
@@ -469,8 +469,8 @@ public class ConcurrentSkipListSet
* underlying sets, differing in that elements outside their range are
* ignored, and attempts to add elements outside their ranges result
* in {@link IllegalArgumentException}. Instances of this class are
- * constructed only using the subSet, headSet, and
- * tailSet methods of their underlying sets.
+ * constructed only using the {@code subSet}, {@code headSet}, and
+ * {@code tailSet} methods of their underlying sets.
*/
static class ConcurrentSkipListSubSet
extends AbstractSet
@@ -483,8 +483,8 @@ public class ConcurrentSkipListSet
/**
* Creates a new submap.
- * @param fromElement inclusive least value, or null if from start
- * @param toElement exclusive upper bound or null if to end
+ * @param fromElement inclusive least value, or {@code null} if from start
+ * @param toElement exclusive upper bound or {@code null} if to end
* @throws IllegalArgumentException if fromElement and toElement
* non-null and fromElement greater than toElement
*/