BuildFrom

scala.collection.BuildFrom
See theBuildFrom companion object
trait BuildFrom[-From, -A, +C] extends Any

Builds a collection of type C from elements of type A when a source collection of type From is available. Implicit instances of BuildFrom are available for all collection types.

Type parameters

A

Type of elements (e.g. Int, Boolean, etc.)

C

Type of collection (e.g. List[Int], TreeMap[Int, String], etc.)

From

Type of source collection

Attributes

Companion
object
Source
BuildFrom.scala
Graph
Supertypes
class Any
Self type
BuildFrom[From, A, C]

Members list

Value members

Abstract methods

def fromSpecific(from: From)(it: IterableOnce[A]^): C^{it}

Attributes

Source
BuildFrom.scala
def newBuilder(from: From): Builder[A, C]

Gets a Builder for the collection. For non-strict collection types this will use an intermediate buffer. Building collections with fromSpecific is preferred because it can be lazy for lazy collections.

Gets a Builder for the collection. For non-strict collection types this will use an intermediate buffer. Building collections with fromSpecific is preferred because it can be lazy for lazy collections.

Value parameters

from

the source collection providing the factory for creating the builder

Attributes

Returns

a new Builder that accepts elements of type A and produces a collection of type C

Source
BuildFrom.scala

Concrete methods

def toFactory(from: From): Factory[A, C]

Partially apply a BuildFrom to a Factory.

Partially apply a BuildFrom to a Factory.

Value parameters

from

the source collection to partially apply, producing a Factory bound to it

Attributes

Returns

a Factory that builds collections of type C from elements of type A, using from as the source collection

Source
BuildFrom.scala

Deprecated methods

def apply(from: From): Builder[A, C]

Attributes

Deprecated
[Since version 2.13.0] Use newBuilder() instead of apply()
Source
BuildFrom.scala