in scala/collection/immutable
class TreeSet

class TreeSet[A](view: (A) => Ordered[A])
extends Tree[A,A]
with ScalaObject
with Set[A]
with java.io.Serializable

This class implements immutable sets using a tree.
Author:
Matthias Zenger, Burak Emir
Version:
1.1, 03/05/2004

Field Summary
protected override type This
     The type returned when creating a new tree.

Method Summary
  def +(elem: A): TreeSet[A]
     This method creates a new set with an additional element.
  def -(elem: A): TreeSet[A]
     - can be used to remove a single element from a set.
protected def New(sz: Int, t: GBTree[A,A]): TreeSet[A]
     This abstract method should be defined by a concrete implementation C[T] as something like:
     override def New(sz:Int,t:aNode):This {
       new C[T](order) {
        override def size=sz;
        override protected def tree:aNode=t;
     }
    
The concrete implementation should also override the def of This override type This = C[T];
  def contains(elem: A): Boolean
     Checks if this set contains element elem.
  def elements: Iterator[A]
     Creates a new iterator over all elements contained in this object.
override def equals(obj: Any): Boolean
     Compares two sets for equality.
protected override def getThis: TreeSet[A]
override def toList: List[A]
     Transform this set into a list of all elements.

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

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

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

Methods inherited from scala/ScalaObject-class
getScalaType

Methods inherited from scala/collection/Set-class
apply, isEmpty, subsetOf, toString

Methods inherited from scala/collection/immutable/Set-class
excl, excl, filter, hashCode, incl, incl, intersect

Methods inherited from scala/collection/immutable/Tree-class
aNode, add, balance, deleteAny, entries, findValue, size, tree, updateOrAdd

Field Detail

This

  protected override type This = TreeSet[A]
The type returned when creating a new tree. This type should be defined by concrete implementations e.g.
   class C[T](...) extends Tree[A,B](...) {
     type This = C[T];
   
Method Detail

getThis

  protected override def getThis: TreeSet[A]

New

  protected def New(sz: Int, t: GBTree[A,A]): TreeSet[A]
This abstract method should be defined by a concrete implementation C[T] as something like:
     override def New(sz:Int,t:aNode):This {
       new C[T](order) {
        override def size=sz;
        override protected def tree:aNode=t;
     }
    
The concrete implementation should also override the def of This override type This = C[T];

contains

  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): TreeSet[A]
This method creates a new set with an additional element.

-

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

elements

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

toList

  override def toList: List[A]
Transform this set into a list of all elements.
Returns:
a list which enumerates all elements of this set.

equals

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