in scala/collection/immutable
class TreeSet
-
class TreeSet[A](view: (A) => Ordered[A])
- extends Tree[A,A]
- with ScalaObject
- with Set[A]
-
This class implements immutable sets using a tree.
- Author:
-
Matthias Zenger, Burak Emir
- Version:
-
1.1, 03/05/2004
Field Summary
|
|
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 val 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.
|
|
def entryKey(entry: A): A
Returns the key of an entry.
|
override
|
def equals(obj: Any): Boolean
Compares two sets for equality.
|
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, hashCode, notify, notifyAll, synchronized, wait, wait, wait |
Methods inherited from scala/collection/immutable/Tree-class
|
GBNil, INode, ITree, aNode, add, balance, balance_list, balance_list_1, delete_any, entries, findValue, is_defined, size, tree, update_or_add |
This
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];
entryKey
def entryKey(entry: A): A
-
Returns the key of an entry.
This method has to be defined by concrete implementations
of the class.
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 val 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.