scala.collection.generic

trait Builder

[source: scala/collection/generic/Builder.scala]

trait Builder[-Elem, +To]
extends Growable[Elem]
The base trait of all builders. A builder lets one construct a collection incrementally, by adding elements to the builder with += and then converting to the required collection type with `result`.
Direct Known Subclasses:
AddingBuilder, LazyBuilder, MapBuilder, MutableMapTemplate, MutableSetTemplate, SetBuilder, TraversableView.NoBuilder, ArrayBuffer, ListBuffer, MutableList, StringBuilder

Method Summary
abstract def += (elem : Elem) : Builder[Elem, To]
Adds a single element to the builder.
abstract def clear : Unit
Clear the contents of this builder
def mapResult [NewTo](f : (To) => NewTo) : Builder[Elem, NewTo]
Create a new builder which is the same as the current builder except that a given function is applied to the current builder's result.
abstract def result : To
Returns collection resulting from this builder. The buffer's contents are undefined afterwards.
def sizeHint (size : Int) : Unit
Give a hint how many elements are expected to be added when the next `result` is called.
Methods inherited from Growable
+=, ++=, ++=
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
abstract def +=(elem : Elem) : Builder[Elem, To]
Adds a single element to the builder.
Parameters
elem - The element to be added
Overrides
Growable.+=

abstract def clear : Unit
Clear the contents of this builder
Overrides
Growable.clear

abstract def result : To
Returns collection resulting from this builder. The buffer's contents are undefined afterwards.

def sizeHint(size : Int) : Unit
Give a hint how many elements are expected to be added when the next `result` is called.

def mapResult[NewTo](f : (To) => NewTo) : Builder[Elem, NewTo]
Create a new builder which is the same as the current builder except that a given function is applied to the current builder's result.
Parameters
f - the function to apply to the builder's result