scala.collection.immutable

class HashSet

[source: scala/collection/immutable/HashSet.scala]

@serializable

class HashSet[A]
extends Set[A] with FlatHashTable[A]
This class implements immutable maps/sets using a hash table. It is optimized for sequential accesses where the last updated table is accessed most often. It supports with reasonable efficiency accesses to previous versions of the table by keeping a change log that's regularly compacted. It needs to synchronize most methods, so it is less suitable for highly concurrent accesses.
Author
Martin Odersky
Version
2.0, 19/01/2007
Value Summary
protected var changedElem : A
protected var deleted : Boolean
protected var later : HashSet[A]
Values and Variables inherited from FlatHashTable
table, tableSize, threshold
Method Summary
def + (elem : A) : Set[A]
Create a new set with an additional element.
def - (elem : A) : Set[A]
Remove a single element from a set.
def contains (elem : A) : Boolean
Checks if this set contains element elem.
override def elements : Iterator[A]
Creates a new iterator over all elements contained in this object.
def empty [C] : Set[C]
override def size : Int
Returns the number of entires in this hash table.
Methods inherited from FlatHashTable
loadFactor, loadFactorDenum, initialSize, findEntry, containsEntry, addEntry, removeEntry, elemHashCode, improve, index, clear
Methods inherited from Set
+, ++, ++, incl, incl, -, --, --, excl, excl, intersect, **, map, flatMap, filter
Methods inherited from Set
apply, isEmpty, subsetOf, *, equals, hashCode, toArray, stringPrefix
Methods inherited from Collection
toString
Methods inherited from Iterable
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
Value Details
protected var later : HashSet[A]

protected var changedElem : A

protected var deleted : Boolean

Method Details
def empty[C] : Set[C]
Returns
an empty set of arbitrary element type
Overrides
Set.empty

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) : Set[A]
Create a new set with an additional element.
Overrides
Set.+

def -(elem : A) : Set[A]
Remove a single element from a set.
Parameters
elem - the element to be removed
Returns
a new set with the element removed.
Overrides
Set.-

override def size : Int
Returns the number of entires in this hash table.
Overrides
FlatHashTable.size

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