scala.collection.mutable

trait SynchronizedSet

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

trait SynchronizedSet[A]
extends Set[A]
This class should be used as a mixin. It synchronizes the Set functions of the class into which it is mixed in.
Author
Matthias Zenger
Version
1.0, 08/07/2003
Since
1
Method Summary
override def ++= (it : Iterator[A]) : SynchronizedSet[A]
Adds a number of elements provided by an iterator to this collection.
override def ++= (that : Traversable[A]) : SynchronizedSet[A]
Adds a number of elements provided by an iterable object to this collection.
def += (elem : A) : SynchronizedSet[A]
Adds a new element to the set.
override def --= (that : Traversable[A]) : SynchronizedSet[A]
Removes a number of elements provided by an iterable object from this collection.
override def --= (it : Iterator[A]) : SynchronizedSet[A]
Removes a number of elements provided by an iterator from this collection.
def -= (elem : A) : SynchronizedSet[A]
Removes a single element from a set.
override def << (cmd : Message[A]) : Unit
Send a message to this scriptable object.
override def add (elem : A) : Boolean
Adds a new element to the set.
def clear : Unit
Removes all elements from the set. After this operation is completed, the set will be empty.
override def clone : Set[A]
This method creates and returns a copy of the receiver object.
def contains (elem : A) : Boolean
Checks if this set contains element elem.
override def foreach [U](f : (A) => U) : Unit
Apply a function f to all elements of this iterable object.
override def intersect (that : Set[A]) : Set[A]
Returns a new set consisting of all elements that are both in the current set and in the argument set.
override def isEmpty : Boolean
Checks if this set is empty.
override def remove (elem : A) : Boolean
Removes a single element from a set.
override def retain (p : (A) => Boolean) : Unit
Removes all elements from the set for which the predicate p yields the value false.
def size : Int
The number of elements in this collection
override def subsetOf (that : Set[A]) : Boolean
Checks if this set is a subset of set that.
override def toList : List[A]
Returns a list with all elements of this traversable object.
override def toString : java.lang.String
Need to override string, so that it's not the Function1's string that gets mixed in.
override 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
companion
Methods inherited from SetLike
newBuilder, result, +, +, ++, ++, -, -, --, --
Methods inherited from Shrinkable
-=
Methods inherited from Builder
sizeHint, mapResult
Methods inherited from Growable
+=
Methods inherited from SetLike
apply, &, **, union, |, diff, &~, stringPrefix, hashCode, equals
Methods inherited from GenericSetTemplate
empty
Methods inherited from Function1
compose, andThen
Methods inherited from IterableLike
iterator (abstract), thisCollection, toCollection, elements, forall, exists, find, foldRight, reduceRight, toIterable, head, take, slice, takeWhile, takeRight, dropRight, copyToArray, zip, zipAll, zipWithIndex, sameElements, toStream, canEqual, view, view, first, firstOption, projection
Methods inherited from GenericTraversableTemplate
genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableLike
repr, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, count, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, tail, last, lastOption, init, drop, dropWhile, span, splitAt, copyToBuffer, copyToArray, toArray, toSeq, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, addString, withFilter
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
The number of elements in this collection

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.

def +=(elem : A) : SynchronizedSet[A]
Adds a new element to the set.
Parameters
elem - the element to be added

override def ++=(that : Traversable[A]) : SynchronizedSet[A]
Adds a number of elements provided by an iterable object to this collection.
Parameters
iter - the iterable object.

override def ++=(it : Iterator[A]) : SynchronizedSet[A]
Adds a number of elements provided by an iterator to this collection.
Parameters
iter - the iterator.

def -=(elem : A) : SynchronizedSet[A]
Removes a single element from a set.
Parameters
elem - The element to be removed.

override def --=(that : Traversable[A]) : SynchronizedSet[A]
Removes a number of elements provided by an iterable object from this collection.
Parameters
iter - the iterable object.

override def --=(it : Iterator[A]) : SynchronizedSet[A]
Removes a number of elements provided by an iterator from this collection.
Parameters
iter - the iterator.

override 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

override def add(elem : A) : Boolean
Adds a new element to the set.
Parameters
elem - the element to be added
Returns
true if the element was not yet present in the set.

override def remove(elem : A) : Boolean
Removes a single element from a set.
Parameters
elem - The element to be removed.
Returns
true if the element was already present in the set.

override def intersect(that : Set[A]) : Set[A]
Returns a new set consisting of all elements that are both in the current set and in the argument set.
Parameters
that - the set to intersect with.

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

override def subsetOf(that : Set[A]) : Boolean
Checks if this set is a subset of set that.
Parameters
that - another set.
Returns
true iff the other set is a superset of this set. todo: rename to isSubsetOf

override def foreach[U](f : (A) => U) : Unit
Apply a function f to all elements of this iterable object.
Parameters
f - A function that is applied for its side-effect to every element. The result (of arbitrary type U) of function `f` is discarded.
Notes
This method underlies the implementation of most other bulk operations. Implementing `foreach` with `iterator` is often suboptimal. So `foreach` should be overridden in concrete collection classes if a more efficient implementation is available.

override def retain(p : (A) => Boolean) : Unit
Removes all elements from the set for which the predicate p yields the value false.

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

override def toString : java.lang.String
Need to override string, so that it's not the Function1's string that gets mixed in.

override def <<(cmd : Message[A]) : Unit
Send a message to this scriptable object.
Parameters
cmd - the message to send.
Throws
<code>Predef.UnsupportedOperationException</code> - if the message was not understood.

override def clone : Set[A]
This method creates and returns a copy of the receiver object.

The default implementation of the clone method is platform dependent.

Returns
a copy of the receiver object.