Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 47 lines (40 sloc) 1.822 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */


package scala.collection
package generic

import mutable.Builder
import scala.annotation.implicitNotFound

/** A base trait for builder factories.
*
* @tparam From the type of the underlying collection that requests
* a builder to be created.
* @tparam Elem the element type of the collection to be created.
* @tparam To the type of the collection to be created.
*
* @see Builder
* @author Martin Odersky
* @author Adriaan Moors
* @since 2.8
*/
@implicitNotFound(msg = "Cannot construct a collection of type ${To} with elements of type ${Elem} based on a collection of type ${From}.")
trait CanBuildFrom[-From, -Elem, +To] {

  /** Creates a new builder on request of a collection.
* @param from the collection requesting the builder to be created.
* @return a builder for collections of type `To` with element type `Elem`.
* The collections framework usually arranges things so
* that the created builder will build the same kind of collection
* as `from`.
*/
  def apply(from: From): Builder[Elem, To]

  /** Creates a new builder from scratch.
*
* @return a builder for collections of type `To` with element type `Elem`.
* @see scala.collection.breakOut
*/
  def apply(): Builder[Elem, To]
}
Something went wrong with that request. Please try again.