blob: 630a0df96cae4923f39dd91d2603cf6e6544fd2e (
plain) (
blame)
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-2010, 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]
}
|