Scala Library Documentation
|
|
scala/collection/Set.scala
]
trait
Set[A]
extends
(A) => Boolean with
Collection[A]A set is a collection that includes at most one of any object.
This trait provides a limited interface, only allowing reading of elements.
There are two extensions of this trait, in packages
scala.collection.mutable
and
scala.collection.immutable
, which provide functionality for
adding and removing objects from the set. The trait in the first package is
for sets that are modified destructively, whereas the trait in
the second package is for immutable sets which create a new set
when something is added or removed to them.
Method Summary | |
def
|
apply
(elem : A) : Boolean
This method allows sets to be interpreted as predicates.
It returns
true , iff this set contains element
elem . |
abstract def
|
contains
(elem : A) : Boolean
Checks if this set contains element
elem . |
override def
|
equals
(that : Any) : Boolean
Compares this set with another object and returns true, iff the
other object is also a set which contains the same elements as
this set.
|
override def
|
hashCode
: Int
hashcode for this set
|
override def
|
isEmpty
: Boolean
Checks if this set is empty.
|
abstract def
|
size
: Int
Returns the number of elements in this set.
|
def
|
subsetOf
(that : Set[A]) : Boolean
Checks if this set is a subset of set
that . |
override def
|
toArray
[B >: A] : Array[B]
Converts this iterable to a fresh Array with elements.
|
Methods inherited from Collection | |
toString, stringPrefix |
Methods inherited from Iterable | |
elements (abstract), concat, ++, map, flatMap, filter, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, mkString, mkString, 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 |
abstract
def
size : Int
elem
.elem -
the element to check for membership.true
iff elem
is contained in this set.true
, iff this set contains element
elem
.elem -
the element to check for membership.true
iff elem
is contained in this set.override
def
isEmpty : Boolean
true
iff there is no element in the set.that
.that -
another set.true
iff the other set is a superset of this set.
todo: rename to isSubsetOfthat -
the other objecttrue
iff this set and the other set contain the same elements.override
def
hashCode : Int
override
def
toArray[B >: A] : Array[B]
Scala Library Documentation
|
|