summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/immutable/TreeSet.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2006-08-31 13:52:34 +0000
committermichelou <michelou@epfl.ch>2006-08-31 13:52:34 +0000
commit5a8391bb88f3dd65458a77539a1475eaa84cc434 (patch)
treec872432cac89bbf51a6aa70e51812c85ff80e5e9 /src/library/scala/collection/immutable/TreeSet.scala
parent33637d5c2f9c10c027ec16e8be31c36fb0f2c9ff (diff)
downloadscala-5a8391bb88f3dd65458a77539a1475eaa84cc434.tar.gz
scala-5a8391bb88f3dd65458a77539a1475eaa84cc434.tar.bz2
scala-5a8391bb88f3dd65458a77539a1475eaa84cc434.zip
cleaned up code in library/scala/**/*.scala
Diffstat (limited to 'src/library/scala/collection/immutable/TreeSet.scala')
-rw-r--r--src/library/scala/collection/immutable/TreeSet.scala85
1 files changed, 44 insertions, 41 deletions
diff --git a/src/library/scala/collection/immutable/TreeSet.scala b/src/library/scala/collection/immutable/TreeSet.scala
index 24a11c8b81..01258ee0f3 100644
--- a/src/library/scala/collection/immutable/TreeSet.scala
+++ b/src/library/scala/collection/immutable/TreeSet.scala
@@ -9,7 +9,7 @@
// $Id$
-package scala.collection.immutable;
+package scala.collection.immutable
/** This class implements immutable sets using a tree.
@@ -22,52 +22,55 @@ package scala.collection.immutable;
[serializable]
class TreeSet[A <% Ordered[A]]() extends Tree[A, A] with Set[A] {
- override protected type This = TreeSet[A];
- override protected def getThis: This = this;
+ override protected type This = TreeSet[A]
+ override protected def getThis: This = this
- protected def New(sz: Int, t: aNode): This = new TreeSet[A] {
- override def size = sz;
- override protected def tree: aNode = t;
- }
+ protected def New(sz: Int, t: aNode): This = new TreeSet[A] {
+ override def size = sz
+ override protected def tree: aNode = t
+ }
- /** Checks if this set contains element <code>elem</code>.
- *
- * @param elem the element to check for membership.
- * @return true, iff <code>elem</code> is contained in this set.
- */
- def contains(elem: A): Boolean = !findValue(elem).isEmpty;
+ /** Checks if this set contains element <code>elem</code>.
+ *
+ * @param elem the element to check for membership.
+ * @return true, iff <code>elem</code> is contained in this set.
+ */
+ def contains(elem: A): Boolean = !findValue(elem).isEmpty
- /** This method creates a new set with an additional element.
- */
- def +(elem: A): TreeSet[A] = updateOrAdd(elem, elem);
+ /** This method creates a new set with an additional element.
+ *
+ * @param elem ...
+ * @return ...
+ */
+ def +(elem: A): TreeSet[A] = updateOrAdd(elem, elem)
- override def empty: Set[A] = New(0, GBLeaf[A,A]());
+ override def empty: Set[A] = New(0, GBLeaf[A,A]())
- /** <code>-</code> can be used to remove a single element from
- * a set.
- */
- def -(elem: A): TreeSet[A] = deleteAny(elem);
+ /** <code>-</code> can be used to remove a single element from
+ * a set.
+ */
+ def -(elem: A): TreeSet[A] = deleteAny(elem)
- /** Creates a new iterator over all elements contained in this
- * object.
- *
- * @return the new iterator
- */
- def elements: Iterator[A] = entries;
+ /** Creates a new iterator over all elements contained in this
+ * object.
+ *
+ * @return the new iterator
+ */
+ def elements: Iterator[A] = entries
- /** Transform this set into a list of all elements.
- *
- * @return a list which enumerates all elements of this set.
- */
- override def toList: List[A] =
- tree.toList(scala.Nil) map (._2);
+ /** Transform this set into a list of all elements.
+ *
+ * @return a list which enumerates all elements of this set.
+ */
+ override def toList: List[A] =
+ tree.toList(scala.Nil) map (._2)
- /** Compares two sets for equality.
- * Two set are equal iff they contain the same elements.
- */
- override def equals(obj: Any): Boolean =
- obj.isInstanceOf[scala.collection.Set[A]] && {
- val that = obj.asInstanceOf[scala.collection.Set[A]];
- (size == that.size) && toList.forall(that.contains);
- }
+ /** Compares two sets for equality.
+ * Two set are equal iff they contain the same elements.
+ */
+ override def equals(obj: Any): Boolean =
+ obj.isInstanceOf[scala.collection.Set[A]] && {
+ val that = obj.asInstanceOf[scala.collection.Set[A]]
+ (size == that.size) && toList.forall(that.contains)
+ }
}