in scala/collection
trait Set

trait Set[A]()
extends Object
with ScalaObject
with (A) => Boolean
with Iterable[A]
Implementing classes or objects:
class SetProxy[A](set: Set[A])
trait Set[A]() in scala/collection/mutable
trait Set[A]() in scala/collection/immutable

This trait defines the interface of collections that do not contain duplicate elements. Trait Set may only be used for accessing elements from set implementations. Two different extensions of trait Set in the package scala.collections.mutable and scala.collections.immutable provide functionality for adding new elements to a set. The trait in the first package is implemented by sets the are modified destructively, whereas the trait in the second package is used by functional set implementations that rely on immutable data structures.
Author:
Matthias Zenger
Version:
1.0, 08/07/2003

Method Summary
  def apply(elem: A): Boolean
     This method allows sets to be interpreted as predicates.
abstract def contains(elem: A): Boolean
     Checks if this set contains element elem.
override def equals(that: Any): Boolean
     Compares this set with another object and returns true, iff the other object is also a set which contains the same elements as this set.
  def isEmpty: Boolean
     Checks if this set is empty.
abstract def size: Int
     Returns the number of elements in this set.
  def subsetOf(that: Set[A]): Boolean
     Checks if this set is a subset of set that.
  def toList: List[A]
     Returns the elements of this set as a list.
override def toString(): String
     Returns a string representation of this set.

Methods inherited from java/lang/Object-class
clone, eq, finalize, getClass, hashCode, notify, notifyAll, synchronized, wait, wait, wait

Methods inherited from scala/Any-class
!=, ==, asInstanceOf, isInstanceOf, match

Methods inherited from scala/Iterable-class
/:, :\, elements, exists, find, foldLeft, foldRight, forall, foreach, sameElements

Method Detail

size

  abstract def size: Int
Returns the number of elements in this set.
Returns:
number of set elements.

contains

  abstract 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.

apply

  def apply(elem: A): Boolean
This method allows sets to be interpreted as predicates. It returns true, iff this set contains element elem.
Parameters:
elem - the element to check for membership.
Returns:
true, iff elem is contained in this set.

isEmpty

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

subsetOf

  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.

equals

  override def equals(that: Any): Boolean
Compares this set with another object and returns true, iff the other object is also a set which contains the same elements as this set.
Parameters:
that - the other object
Returns:
true, iff this set and the other set contain the same elements.

toList

  def toList: List[A]
Returns the elements of this set as a list.
Returns:
a list containing all set elements.

toString

  override def toString(): String
Returns a string representation of this set.
Returns:
a string showing all elements of this set.