1313package scala .collection .compat
1414
1515import scala .collection .generic .CanBuildFrom
16- import scala .collection .{ Iterable , mutable }
16+ import scala .collection .mutable
1717
1818/** Builds a collection of type `C` from elements of type `A` when a source collection of type `From` is available.
1919 * Implicit instances of `BuildFrom` are available for all collection types.
@@ -23,16 +23,14 @@ import scala.collection.{Iterable, mutable}
2323 * @tparam C Type of collection (e.g. `List[Int]`, `TreeMap[Int, String]`, etc.)
2424 */
2525trait BuildFrom [- From , - A , + C ] extends Any {
26-
27- def fromSpecificIterable (from : From )(it : Iterable [A ]): C
26+ def fromSpecific (from : From )(it : IterableOnce [A ]): C
2827
2928 /** Get a Builder for the collection. For non-strict collection types this will use an intermediate buffer.
30- * Building collections with `fromSpecificIterable ` is preferred because it can be lazy for lazy collections. */
29+ * Building collections with `fromSpecific ` is preferred because it can be lazy for lazy collections. */
3130 def newBuilder (from : From ): mutable.Builder [A , C ]
3231
33- @ deprecated(" Use newBuilder instead of apply()" , " 2.13.0" )
32+ @ deprecated(" Use newBuilder() instead of apply()" , " 2.13.0" )
3433 @ `inline` def apply (from : From ): mutable.Builder [A , C ] = newBuilder(from)
35-
3634}
3735
3836object BuildFrom {
@@ -41,7 +39,7 @@ object BuildFrom {
4139 implicit def fromCanBuildFrom [From , A , C ](
4240 implicit cbf : CanBuildFrom [From , A , C ]): BuildFrom [From , A , C ] =
4341 new BuildFrom [From , A , C ] {
44- def fromSpecificIterable (from : From )(it : Iterable [A ]): C = (cbf(from) ++= it).result()
42+ def fromSpecific (from : From )(it : IterableOnce [A ]): C = (cbf(from) ++= it).result()
4543 def newBuilder (from : From ): mutable.Builder [A , C ] = cbf(from)
4644 }
4745
0 commit comments