diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-05-19 09:31:06 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-05-19 09:31:06 +0000 |
commit | d6191fcdbff5f16e857e92dd10cbabe41ab9b66d (patch) | |
tree | 9506eecdbdac843ba9fe8e823c1a9cb5ce0dcfb4 /src/library/scala/collection/mutable/SetLike.scala | |
parent | 4d11985231229984fd207dcd633d070ff24c97fb (diff) | |
download | scala-d6191fcdbff5f16e857e92dd10cbabe41ab9b66d.tar.gz scala-d6191fcdbff5f16e857e92dd10cbabe41ab9b66d.tar.bz2 scala-d6191fcdbff5f16e857e92dd10cbabe41ab9b66d.zip |
Fixes #3385. No review.
Diffstat (limited to 'src/library/scala/collection/mutable/SetLike.scala')
-rw-r--r-- | src/library/scala/collection/mutable/SetLike.scala | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/src/library/scala/collection/mutable/SetLike.scala b/src/library/scala/collection/mutable/SetLike.scala index 6f91997b83..78e82eb06b 100644 --- a/src/library/scala/collection/mutable/SetLike.scala +++ b/src/library/scala/collection/mutable/SetLike.scala @@ -46,6 +46,10 @@ import scala.annotation.migration * }}} * It is also good idea to override methods `foreach` and * `size` for efficiency. + * @define addDuplicates + * Note that duplicates (elements for which `equals` yields true) will be + * removed, but it is not specified whether it will be an element of this + * set or a newly added element. * @define coll mutable set * @define Coll mutable.Set */ @@ -131,10 +135,12 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] */ def result: This = repr - /** Adds a single element to this collection and returns - * the collection itself. + /** Creates a new set consisting of all the elements of this set and `elem`. + * + * $addDuplicates * * @param elem the element to add. + * @return a new set consisting of elements of this set and `elem`. */ @migration(2, 8, "As of 2.8, this operation creates a new set. To add an element as a\n"+ @@ -142,12 +148,16 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] ) override def + (elem: A): This = clone() += elem - /** Adds two or more elements to this collection and returns - * the collection itself. + /** Creates a new set consisting of all the elements of this set and two or more + * specified elements. + * + * $addDuplicates * * @param elem1 the first element to add. * @param elem2 the second element to add. * @param elems the remaining elements to add. + * @return a new set consisting of all the elements of this set, `elem1`, + * `elem2` and those in `elems`. */ @migration(2, 8, "As of 2.8, this operation creates a new set. To add the elements as a\n"+ @@ -156,10 +166,13 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] override def + (elem1: A, elem2: A, elems: A*): This = clone() += elem1 += elem2 ++= elems - /** Adds a number of elements provided by a traversable object and returns - * either the collection itself. + /** Creates a new set consisting of all the elements of this set and those + * provided by the specified traversable object. + * + * $addDuplicates * - * @param iter the iterable object. + * @param xs the traversable object. + * @return a new set cconsisting of elements of this set and those in `xs`. */ @migration(2, 8, "As of 2.8, this operation creates a new set. To add the elements as a\n"+ @@ -167,10 +180,10 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] ) override def ++(xs: TraversableOnce[A]): This = clone() ++= xs - /** Removes a single element from this collection and returns - * the collection itself. + /** Creates a new set consisting of all the elements of this set except `elem`. * * @param elem the element to remove. + * @return a new set consisting of all the elements of this set except `elem`. */ @migration(2, 8, "As of 2.8, this operation creates a new set. To remove the element as a\n"+ @@ -178,12 +191,14 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] ) override def -(elem: A): This = clone() -= elem - /** Removes two or more elements from this collection and returns - * the collection itself. + /** Creates a new set consisting of all the elements of this set except the two + * or more specified elements. * * @param elem1 the first element to remove. * @param elem2 the second element to remove. * @param elems the remaining elements to remove. + * @return a new set consisting of all the elements of this set except + * `elem1`, `elem2` and `elems`. */ @migration(2, 8, "As of 2.8, this operation creates a new set. To remove the elements as a\n"+ @@ -192,10 +207,12 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] override def -(elem1: A, elem2: A, elems: A*): This = clone() -= elem1 -= elem2 --= elems - /** Removes a number of elements provided by a Traversable object and returns - * the collection itself. + /** Creates a new set consisting of all the elements of this set except those + * provided by the specified traversable object. * - * @param iter the Traversable object. + * @param xs the traversable object. + * @return a new set consisting of all the elements of this set except + * elements from `xs`. */ @migration(2, 8, "As of 2.8, this operation creates a new set. To remove the elements as a\n"+ |