scala.collection.immutable

class ListSet

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

@serializable

class ListSet[A]
extends Set[A] with GenericSetTemplate[A, ListSet] with SetLike[A, ListSet[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
Since
1
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.
override def companion : GenericCompanion[ListSet]
The factory companion object that builds instances of class CC
def contains (elem : A) : Boolean
Checks if this set contains element elem.
protected def elem : A
override def isEmpty : Boolean
Checks if this set is empty.
def iterator : Iterator[A]
Creates a new iterator over all elements contained in this set.
protected def next : ListSet[A]
override def size : Int
Returns the number of elements in this set.
Methods inherited from SetLike
newBuilder, apply, intersect, &, **, union, |, diff, &~, subsetOf, stringPrefix, toString, hashCode, equals
Methods inherited from Subtractable
-, --, --
Methods inherited from Addable
+, ++, ++
Methods inherited from GenericSetTemplate
empty
Methods inherited from Function1
compose, andThen
Methods inherited from IterableLike
thisCollection, toCollection, elements, foreach, 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, toList, toSeq, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, addString, withFilter
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
override def companion : GenericCompanion[ListSet]
The factory companion object that builds instances of class CC
Overrides
Set.companion

override 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.
Overrides
SetLike.isEmpty

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.
Overrides
SetLike.contains

def +(elem : A) : ListSet[A]
This method creates a new set with an additional element.
Overrides
SetLike.+

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

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

protected def elem : A
Throws
Predef.NoSuchElementException -

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