Skip to content

Commit 903a6fa

Browse files
committed
Upgrade BuildFrom to the latest definition from 2.13
1 parent f7783f7 commit 903a6fa

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

compat/src/main/scala-2.11_2.12/scala/collection/compat/BuildFrom.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
package scala.collection.compat
1414

1515
import 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
*/
2525
trait 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

3836
object 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

Comments
 (0)