Scala Library Documentation


scala/collection/mutable/Set.scala
]
trait
Set[A]
extends
Set[A] with
Scriptable[Message[A]] with
CloneableCollectionscala.collection.Set
as well as for +=
,
= and clear
.

Author
 Matthias Zenger

Version
 1.1, 09/05/2004
 Direct Known Subclasses:
 Set, BitSet, HashSet, ImmutableSetAdaptor, JavaSetAdaptor, LinkedHashSet, ObservableSet, SetProxy, SynchronizedSet
Method Summary
def
+
(elem : A) : Set[A]
Add a new element to the set.
def
+
(elem1 : A, elem2 : A, elems : A*) : Set[A]
Add two or more elements to this set.
def
++
(elems : Iterable[A]) : Set[A]
Add all the elements provided by an iterator
of the iterable object elems
to the set.
def
++
(elems : Iterator[A]) : Set[A]
Add all the elements provided by an iterator
elems
to the set.
def
++=
(elems : Iterator[A]) : Unit
Add all the elements provided by an iterator
elems
to the set.
def
++=
(elems : Iterable[A]) : Unit
Add all the elements provided by an iterator
of the iterable object that
to the set.
abstract def
+=
(elem : A) : Unit
Add a new element to the set.
def
+=
(elem1 : A, elem2 : A, elems : A*) : Unit
Add two or more elements to this set.
def

(elem1 : A, elem2 : A, elems : A*) : Set[A]
Remove two or more elements from this set.
def

(elem : A) : Set[A]
Remove a new element from the set.
def

(elems : Iterable[A]) : Set[A]
Remove all the elements provided by an iterator
of the iterable object elems
from the set.
def

(elems : Iterator[A]) : Set[A]
Remove all the elements provided by an iterator
elems
from the set.
def
=
(elems : Iterator[A]) : Unit
Remove all the elements provided by an iterator
elems
from the set.
def
=
(elems : Iterable[A]) : Unit
Remove all the elements provided by an iterator
of the iterable object elems
from the set.
def
=
(elem1 : A, elem2 : A, elems : A*) : Unit
Remove two or more elements from this set.
abstract def
=
(elem : A) : Unit
Removes a single element from a set.
def
<<
(cmd : Message[A]) : Unit
Send a message to this scriptable object.
def
clear
: Unit
Removes all elements from the set. After this operation is completed,
the set will be empty.
override def
clone
: Set[A]
Return a clone of this set.
def
excl
(elems : A*) : Unit
excl
removes many elements from the set.
def
incl
(elems : A*) : Unit
incl
can be used to add many elements to the set
at the same time.
def
intersect
(that : Set[A]) : Unit
This method computes an intersection with set that
.
It removes all the elements that are not present in that
.
def
readOnly
: Set[A]
Return a readonly projection of this set
def
retain
(p : (A) => Boolean) : Unit
Method retain removes all elements from the set for
which the predicate p
yields the value false
.
def
update
(elem : A, included : Boolean) : Unit
This method allows one to add or remove an element elem
from this set depending on the value of parameter included
.
Typically, one would use the following syntax:
set(elem) = true
Methods inherited from Set
size (abstract), contains (abstract), apply, isEmpty, subsetOf, *, **, equals, hashCode, toArray, stringPrefix
Methods inherited from Collection
toString
Methods inherited from Iterable
elements (abstract), concat, ++, map, flatMap, filter, partition, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, toStream, mkString, mkString, mkString, addString, addString, copyToArray, projection, hasDefiniteSize
Methods inherited from Function1
compose, andThen
Methods inherited from AnyRef
getClass, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
 This method allows one to add or remove an element
elem
from this set depending on the value of parameter included
.
Typically, one would use the following syntax:
set(elem) = true
 Add a new element to the set.

Parameters
elem 
the element to be added
 Add two or more elements to this set.

Parameters
elem1 
the first element.kv2 
the second element.kvs 
the remaining elements.
 Add all the elements provided by an iterator
of the iterable object
that
to the set.

Parameters
elems 
the iterable object containing the elements to be added
 Add all the elements provided by an iterator
elems
to the set.

Parameters
elems 
the iterator containing the elements to be added
 Add a new element to the set.

Returns
 the set itself with the element added.

Parameters
elem 
the element to be added
 Add two or more elements to this set.

Parameters
elem1 
the first element.kv2 
the second element.kvs 
the remaining elements.
Returns
 the set itself with the elements added.
 Add all the elements provided by an iterator
of the iterable object
elems
to the set.

Parameters
elems 
the iterable object containing the elements to be added
Returns
 the set itself with the elements added.
 Add all the elements provided by an iterator
elems
to the set.

Parameters
elems 
the iterator containing the elements to be added

@deprecated
def
incl(elems : A*) : Unit
incl
can be used to add many elements to the set
at the same time.

Deprecated
 use
++=
instead
 Removes a single element from a set.

Parameters
elem 
The element to be removed.
 Remove two or more elements from this set.

Parameters
elem1 
the first element.elem2 
the second element.elems 
the remaining elements.
 Remove all the elements provided by an iterator
of the iterable object
elems
from the set.
 Remove all the elements provided by an iterator
elems
from the set.
 Remove a new element from the set.

Returns
 the set itself with the element removed.

Parameters
elem 
the element to be removed
 Remove two or more elements from this set.

Parameters
elem1 
the first element.elem2 
the second element.elems 
the remaining elements.
Returns
 the set itself with the elements removed.
 Remove all the elements provided by an iterator
of the iterable object
elems
from the set.

Parameters
elems 
An iterable object containing the elements to remove from the set.
Returns
 the set itself with the elements removed.
 Remove all the elements provided by an iterator
elems
from the set.

Parameters
elems 
An iterator containing the elements to remove from the set.
Returns
 the set itself with the elements removed.

@deprecated
def
excl(elems : A*) : Unit
excl
removes many elements from the set.
 This method computes an intersection with set
that
.
It removes all the elements that are not present in that
.

Parameters
that 
the set to intersect with.
 Method
retain removes all elements from the set for
which the predicate p
yields the value false
.

def
clear : Unit
 Removes all elements from the set. After this operation is completed,
the set will be empty.
 Send a message to this scriptable object.

Parameters
cmd 
the message to send.
Throws
<code>Predef.UnsupportedOperationException</code> 
if the message was not understood.

Overrides

Scriptable.<<
 Return a clone of this set.

Returns
 a set with the same elements.

Overrides

CloneableCollection.clone
 Return a readonly projection of this set
Scala Library Documentation