|
Scala Library
|
|
scala/collection/immutable/Set.scala]
trait
Set[A]
extends Set[A]This class defines the interface for immutable sets. Operations on an immutable set leave the original set unchanged, and return a new set if needed.
Concrete set implementations just have to provide functionality for
the abstract methods in scala.collection.Set as well as
for + and -.
Note that abstract immutable.Set's are not covariant in their type
parameter. This is because some implementations cannot support the
+ method for arbitrary types.
| Method Summary | |
override def
|
**
(that : Set[A]) : Set[A]
This method is an alias for
intersect.
It computes an intersection with set that.
It removes all the elements that are not present in that. |
abstract def
|
+
(elem : A) : Set[A]
Create a new set with an additional element.
|
def
|
+
(elem1 : A, elem2 : A, elems : A*) : Set[A]
Add two or more elements to this set.
|
def
|
++
(elems : Iterator[A]) : Set[A]
Add all the elements provided by an iterator to the set.
|
def
|
++
(elems : Iterable[A]) : Set[A]
Add all the elements provided by an iterator
of the iterable object
elems to the set. |
abstract def
|
-
(elem : A) : Set[A]
Remove a single element from a set.
|
def
|
-
(elem1 : A, elem2 : A, elems : A*) : Set[A]
Remove two or more elements from this 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. |
abstract def
|
empty [B] : Set[B] |
def
|
excl
(elems : A*) : Set[A]
excl removes many elements from the set. |
def
|
excl
(that : Iterable[A]) : Set[A]
This method removes all the elements provided by an iterator
of the iterable object
that from the set. |
override def
|
filter
(p : (A) => Boolean) : Set[A]
Method
filter removes all elements from the set for
which the predicate p yields the value false. |
override def
|
flatMap
[B](f : (A) => Iterable[B]) : Set[B]
Applies the given function
f to each element of
this set, then forms the union of all results. |
def
|
incl
(elems : A*) : Set[A]
incl can be used to add many elements to the set
at the same time. |
def
|
incl
(that : Iterable[A]) : Set[A]
This method will add all the elements provided by an iterator
of the iterable object
that to the set. |
def
|
intersect
(that : Set[A]) : Set[A]
This method computes an intersection with set
that.
It removes all the elements that are not present in that. |
override def
|
map
[B](f : (A) => B) : Set[B]
Returns the set resulting from applying the given function
f to each
element of this set. |
| 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, ++, partition, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, toSeq, toStream, mkString, mkString, mkString, addString, addString, addString, copyToArray, projection, hasDefiniteSize |
| Methods inherited from Function1 | |
| compose, andThen |
| Methods inherited from AnyRef | |
| getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
| Methods inherited from Any | |
| ==, !=, isInstanceOf, asInstanceOf |
| Method Details |
elem1 - the first element.elem2 - the second element.elems - the remaining elements.elems to the set.elems - the iterable object containing the elements to be addedelems - the iterator containing the elements to be added
def
incl(elems : A*) : Set[A]
incl can be used to add many elements to the set
at the same time.+ instead
def
incl(that : Iterable[A]) : Set[A]
that to the set.++ insteadelem - the element to be removedelem1 - the first element.elem2 - the second element.elems - the remaining elements.elems from the set.elems - An iterable object containing the elements to remove from the set.elems from the set.elems - An iterator containing the elements to remove from the set.
def
excl(elems : A*) : Set[A]
excl removes many elements from the set.
def
excl(that : Iterable[A]) : Set[A]
that from the set.that - the iterable collection.that.
It removes all the elements that are not present in that.that - the set to intersect with.intersect.
It computes an intersection with set that.
It removes all the elements that are not present in that.that - the set to intersect withf to each
element of this set.f - function to apply to each element.f(a0), ..., f(an) if this set contains a0, ..., an.f to each element of
this set, then forms the union of all results.f - function to apply to each element.f(a0), ..., f(an) if this set contains a0, ..., an.filter removes all elements from the set for
which the predicate p yields the value false.p - The predicate used to filter the set|
Scala Library
|
|