Packages

class SetBuilder[A, Coll <: collection.Set[A] with collection.SetLike[A, Coll]] extends ReusableBuilder[A, Coll]

The canonical builder for mutable Sets.

A

The type of the elements that will be contained in this set.

Coll

The type of the actual collection this set builds.

Source
SetBuilder.scala
Since

2.8

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SetBuilder
  2. ReusableBuilder
  3. Builder
  4. Growable
  5. Clearable
  6. AnyRef
  7. Any
Implicitly
  1. by CollectionsHaveToParArray
  2. by any2stringadd
  3. by StringFormat
  4. by Ensuring
  5. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SetBuilder(empty: Coll)

    empty

    The empty element of the collection.

Value Members

  1. def ++=(xs: TraversableOnce[A]): SetBuilder.this.type

    adds all elements produced by a TraversableOnce to this growable collection.

    adds all elements produced by a TraversableOnce to this growable collection.

    xs

    the TraversableOnce producing the elements to add.

    returns

    the growable collection itself.

    Definition Classes
    Growable
  2. def +=(x: A): SetBuilder.this.type

    Adds a single element to the builder.

    Adds a single element to the builder.

    returns

    the builder itself.

    Definition Classes
    SetBuilderBuilderGrowable
  3. def +=(elem1: A, elem2: A, elems: A*): SetBuilder.this.type

    adds two or more elements to this growable collection.

    adds two or more elements to this growable collection.

    elem1

    the first element to add.

    elem2

    the second element to add.

    elems

    the remaining elements to add.

    returns

    the growable collection itself

    Definition Classes
    Growable
  4. def clear(): Unit

    Clears the contents of this builder.

    Clears the contents of this builder. After execution of this method, the builder will contain no elements.

    If executed immediately after a call to result, this allows a new instance of the same type of collection to be built.

    Definition Classes
    SetBuilderReusableBuilderBuilderGrowableClearable
  5. def mapResult[NewTo](f: (Coll) ⇒ NewTo): Builder[A, NewTo]

    Creates a new builder by applying a transformation function to the results of this builder.

    Creates a new builder by applying a transformation function to the results of this builder.

    NewTo

    the type of collection returned by f.

    f

    the transformation function.

    returns

    a new builder which is the same as the current builder except that a transformation function is applied to this builder's result.

    Definition Classes
    Builder
    Note

    The original builder should no longer be used after mapResult is called.

  6. def result(): Coll

    Produces a collection from the added elements.

    Produces a collection from the added elements.

    After a call to result, the behavior of all other methods is undefined save for clear. If clear is called, then the builder is reset and may be used to build another instance.

    returns

    a collection containing the elements added to this builder.

    Definition Classes
    SetBuilderReusableBuilderBuilder
  7. def sizeHint(coll: TraversableLike[_, _], delta: Int): Unit

    Gives a hint that one expects the result of this builder to have the same size as the given collection, plus some delta.

    Gives a hint that one expects the result of this builder to have the same size as the given collection, plus some delta. This will provide a hint only if the collection is known to have a cheap size method. Currently this is assumed to be the case if and only if the collection is of type IndexedSeqLike. Some builder classes will optimize their representation based on the hint. However, builder implementations are still required to work correctly even if the hint is wrong, i.e. a different number of elements is added.

    coll

    the collection which serves as a hint for the result's size.

    delta

    a correction to add to the coll.size to produce the size hint.

    Definition Classes
    Builder
  8. def sizeHint(coll: TraversableLike[_, _]): Unit

    Gives a hint that one expects the result of this builder to have the same size as the given collection, plus some delta.

    Gives a hint that one expects the result of this builder to have the same size as the given collection, plus some delta. This will provide a hint only if the collection is known to have a cheap size method, which is determined by calling sizeHint.

    Some builder classes will optimize their representation based on the hint. However, builder implementations are still required to work correctly even if the hint is wrong, i.e. a different number of elements is added.

    coll

    the collection which serves as a hint for the result's size.

    Definition Classes
    Builder
  9. def sizeHint(size: Int): Unit

    Gives a hint how many elements are expected to be added when the next result is called.

    Gives a hint how many elements are expected to be added when the next result is called. Some builder classes will optimize their representation based on the hint. However, builder implementations are still required to work correctly even if the hint is wrong, i.e. a different number of elements is added.

    size

    the hint how many elements will be added.

    Definition Classes
    Builder
  10. def sizeHintBounded(size: Int, boundingColl: TraversableLike[_, _]): Unit

    Gives a hint how many elements are expected to be added when the next result is called, together with an upper bound given by the size of some other collection.

    Gives a hint how many elements are expected to be added when the next result is called, together with an upper bound given by the size of some other collection. Some builder classes will optimize their representation based on the hint. However, builder implementations are still required to work correctly even if the hint is wrong, i.e. a different number of elements is added.

    size

    the hint how many elements will be added.

    boundingColl

    the bounding collection. If it is an IndexedSeqLike, then sizes larger than collection's size are reduced.

    Definition Classes
    Builder
  11. def toParArray: ParArray[T]
    Implicit
    This member is added by an implicit conversion from SetBuilder[A, Coll] to CollectionsHaveToParArray[SetBuilder[A, Coll], T] performed by method CollectionsHaveToParArray in scala.collection.parallel. This conversion will take place only if an implicit value of type (SetBuilder[A, Coll]) ⇒ GenTraversableOnce[T] is in scope.
    Definition Classes
    CollectionsHaveToParArray