scala.collection.immutable
class TreeSet

[source: `scala/collection/immutable/TreeSet.scala`]

@serializable
`` `class` TreeSet[A](`val` size : Int, t : Tree[Unit], `implicit` view$2 : (A) => Ordered[A])
  `extends` RedBlack[A]`with` SortedSet[A]

  This class implements immutable sets using a tree.

Author
  Martin Odersky
Version
  2.0, 02/01/2007

Additional Constructor Summary
`def` | this ()(`implicit` view$3 : (A) => Ordered[A]) : TreeSet[A]

Value Summary
`protected val` | tree : Tree[Unit]

Method Summary
`def` | + (elem : A) : TreeSet[A] A new TreeSet with the entry added is returned,
`def` | - (elem : A) : TreeSet[A] Remove a single element from a set.
`override def` | compare (a0 : A, a1 : A) : Int Comparison function that orders keys.
`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` | elementsSlow : Iterator[A]
`def` | empty [B] : Set[B] A factory to create empty maps of the same type of keys.
`override def` | exists (f : (A) => Boolean) : Boolean Apply a predicate `p` to all elements of this iterable object and return true, iff there is at least one element for which `p` yields true.
`override def` | firstKey : A Returns the first key of the collection.
`override def` | forall (f : (A) => Boolean) : Boolean Apply a predicate `p` to all elements of this iterable object and return true, iff the predicate yields true for all elements.
`override def` | foreach (f : (A) => Unit) : Unit Apply a function `f` to all elements of this iterable object.
`def` | insert (elem : A) : TreeSet[A] A new TreeSet with the entry added is returned, assuming that elem is not in the TreeSet.
`def` | isSmaller (x : A, y : A) : Boolean
`override def` | lastKey : A Returns the last key of the collection.
`override def` | rangeImpl (from : Option[A], until : Option[A]) : TreeSet[A] Creates a ranged projection of this collection. Any mutations in the ranged projection will update this collection and vice versa. Keys are garuanteed to be consistent between the collection and its projection.

Methods inherited from Set
+, ++, ++, incl, incl, -, --, --, excl, excl, intersect, **, map, flatMap, filter

Methods inherited from SortedSet
keySet, from, until, range, subsetOf

Methods inherited from Sorted
to, hasAll

Methods inherited from Set
apply, isEmpty, equals, hashCode, toArray

Methods inherited from Collection
toString, stringPrefix

Methods inherited from Iterable
concat, ++, takeWhile, dropWhile, take, drop, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, toStream, mkString, mkString, mkString, addString, addString, copyToArray, projection, hasDefiniteSize

Methods inherited from Function1
compose, andThen

Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized

Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf

Additional Constructor Details

`` `def` this()(`implicit` view$3 : (A) => Ordered[A]) : TreeSet[A]

Value Details

`protected` `val` tree : Tree[Unit]

Method Details

`` `def` isSmaller(x : A, y : A) : Boolean

Overrides
  RedBlack.isSmaller

`` `def` empty[B] : Set[B]

  A factory to create empty maps of the same type of keys.

`` `def` +(elem : A) : TreeSet[A]

  A new TreeSet with the entry added is returned,

`` `def` insert(elem : A) : TreeSet[A]

  A new TreeSet with the entry added is returned, assuming that elem is not in the TreeSet.

`` `def` -(elem : A) : TreeSet[A]

  Remove a single element from a set.

Parameters
  `elem -` the element to be removed
Returns
  a new set with the element removed.

`` `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` elements : Iterator[A]

  Creates a new iterator over all elements contained in this object.

Returns
  the new iterator

`` `def` elementsSlow : Iterator[A]

`override` `def` foreach(f : (A) => Unit) : Unit

  Apply a function `f` to all elements of this iterable object.

Notes
  Will not terminate for infinite-sized collections.
Parameters
  `f -` a function that is applied to every element.

`override` `def` forall(f : (A) => Boolean) : Boolean

  Apply a predicate `p` to all elements of this iterable object and return true, iff the predicate yields true for all elements.

Notes
  May not terminate for infinite-sized collections.
Parameters
  `p -` the predicate
Returns
  true, iff the predicate yields true for all elements.

`override` `def` exists(f : (A) => Boolean) : Boolean

  Apply a predicate `p` to all elements of this iterable object and return true, iff there is at least one element for which `p` yields true.

Notes
  May not terminate for infinite-sized collections.
Parameters
  `p -` the predicate
Returns
  true, iff the predicate yields true for at least one element.

`override` `def` rangeImpl(from : Option[A], until : Option[A]) : TreeSet[A]

  Creates a ranged projection of this collection. Any mutations in the ranged projection will update this collection and vice versa. Keys are garuanteed to be consistent between the collection and its projection.

Parameters
  `from -` The lower-bound (inclusive) of the ranged projection. `None` if there is no lower bound.
  `until -` The upper-bound (exclusive) of the ranged projection. `None` if there is no upper bound.

`override` `def` firstKey : A

  Returns the first key of the collection.

`override` `def` lastKey : A

  Returns the last key of the collection.

`override` `def` compare(a0 : A, a1 : A) : Int

  Comparison function that orders keys.