scala.collection.mutable

class ImmutableSetAdaptor

[source: scala/collection/mutable/ImmutableSetAdaptor.scala]

@serializable

class ImmutableSetAdaptor[A](protected val set : Set[A])
extends Set[A]
This class can be used as an adaptor to create mutable sets from immutable set implementations. Only method empty has to be redefined if the immutable set on which this mutable set is originally based is not empty. empty is supposed to return the representation of an empty set.
Author
Matthias Zenger
Version
1.0, 21/07/2003
Method Summary
def += (elem : A) : Unit
Add a new element to the set.
def -= (elem : A) : Unit
Removes a single element from a set.
override def clear : Unit
Removes all elements from the set. After this operation is completed, the set will be empty.
def contains (elem : A) : Boolean
Checks if this set contains element elem.
def elements : Iterator[A]
Creates a new iterator over all elements contained in this object.
override def exists (p : (A) => Boolean) : Boolean
Apply a predicate p to all elements of this iterable object and return true, iff there is at least one element for which p yields true.
override def foreach (f : (A) => Unit) : Unit
Apply a function f to all elements of this iterable object.
override def isEmpty : Boolean
Checks if this set is empty.
def size : Int
Returns the number of elements in this set.
override def toList : List[A]
Create a fresh list with all the elements of this iterable object.
override def toString : java.lang.String
Methods inherited from Set
update, +=, ++=, ++=, +, +, ++, ++, incl, -=, --=, --=, -, -, --, --, excl, intersect, retain, <<, clone, readOnly
Methods inherited from Set
apply, subsetOf, *, **, equals, hashCode, toArray, stringPrefix
Methods inherited from Iterable
concat, ++, map, flatMap, filter, partition, takeWhile, dropWhile, take, drop, forall, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, 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
def size : Int
Returns the number of elements in this set.
Returns
number of set elements.

override def isEmpty : Boolean
Checks if this set is empty.
Returns
true iff there is no element in the set.

def contains(elem : A) : Boolean
Checks if this set contains element elem.
Parameters
elem - the element to check for membership.
Returns
true iff elem is contained in this set.

override def foreach(f : (A) => Unit) : Unit
Apply a function f to all elements of this iterable object.
Notes
Will not terminate for infinite-sized collections.
Parameters
f - a function that is applied to every element.

override def exists(p : (A) => Boolean) : Boolean
Apply a predicate p to all elements of this iterable object and return true, iff there is at least one element for which p yields true.
Notes
May not terminate for infinite-sized collections.
Parameters
p - the predicate
Returns
true, iff the predicate yields true for at least one element.

override def toList : List[A]
Create a fresh list with all the elements of this iterable object.
Notes
Will not terminate for infinite-sized collections.

override def toString : java.lang.String

def elements : Iterator[A]
Creates a new iterator over all elements contained in this object.
Returns
the new iterator

def +=(elem : A) : Unit
Add a new element to the set.
Parameters
elem - the element to be added
Overrides
Set.+=

def -=(elem : A) : Unit
Removes a single element from a set.
Parameters
elem - The element to be removed.
Overrides
Set.-=

override def clear : Unit
Removes all elements from the set. After this operation is completed, the set will be empty.
Overrides
Set.clear