scala.collection.immutable

class ListSet

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

@serializable

class ListSet[A]
extends Set[A]
This class implements immutable sets using a list-based data structure. Instances of ListSet represent empty sets; they can be either created by calling the constructor directly, or by applying the function ListSet.empty.
Author
Matthias Zenger
Version
1.0, 09/07/2003
Direct Known Subclasses:
ListSet.Node

Method Summary
def + (elem : A) : ListSet[A]
This method creates a new set with an additional element.
def - (elem : A) : ListSet[A]
- can be used to remove a single element from a set.
def contains (elem : A) : Boolean
Checks if this set contains element elem.
protected def elem : A
def elements : Iterator[A]
Creates a new iterator over all elements contained in this set.
def empty [B] : ListSet[B]
override def equals (obj : Any) : Boolean
Compares two sets for equality. Two set are equal iff they contain the same elements.
override def isEmpty : Boolean
Checks if this set is empty.
protected def next : ListSet[A]
def size : Int
Returns the number of elements in this set.
Methods inherited from Set
+, ++, ++, incl, incl, -, --, --, excl, excl, intersect, **, map, flatMap, filter
Methods inherited from Set
apply, subsetOf, *, 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
Class Summary
protected class Node (protected val override elem : A) extends ListSet[A]
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 empty[B] : ListSet[B]
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) : ListSet[A]
This method creates a new set with an additional element.
Overrides
Set.+

def -(elem : A) : ListSet[A]
- can be used to remove a single element from a set.
Overrides
Set.-

def elements : Iterator[A]
Creates a new iterator over all elements contained in this set.
Throws
Predef.NoSuchElementException -
Returns
the new iterator

override def equals(obj : Any) : Boolean
Compares two sets for equality. Two set are equal iff they contain the same elements.

protected def elem : A
Throws
Predef.NoSuchElementException -

protected def next : ListSet[A]
Throws
Predef.NoSuchElementException -