Skip to content

Commit 4bc4693

Browse files
committed
Rename collectAs -> to
1 parent d42f4fe commit 4bc4693

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/strawman/collections/CollectionStrawMan1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ object CollectionStrawMan1 {
5252
def isEmpty: Boolean = !iterator.hasNext
5353
def head: A = iterator.next
5454
def view: View[A] = new View(iterator)
55-
def collectAs[C[X] <: Iterable[X]](fi: FromIterator[C]): C[A] = fi.fromIterator(iterator)
55+
def to[C[X] <: Iterable[X]](fi: FromIterator[C]): C[A] = fi.fromIterator(iterator)
5656
}
5757

5858
/** Transforms returning same collection type */
@@ -216,7 +216,7 @@ object CollectionStrawMan1 {
216216

217217
implicit class ViewOps[A](val v: View[A]) extends AnyVal with Ops[A] {
218218
def iterator = v.iterator
219-
def cache = collectAs(ArrayBuffer).view
219+
def cache = to(ArrayBuffer).view
220220
}
221221

222222
implicit class ViewMonoTransforms[A](val v: View[A])

tests/run/CollectionTests.scala

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object Test {
1414
val y3: Int = x3
1515
val x4 = xs.head
1616
val y4: Int = x4
17-
val x5 = xs.collectAs(List)
17+
val x5 = xs.to(List)
1818
val y5: List[Int] = x5
1919
val (xs6, xs7) = xs.partition(_ % 2 == 0)
2020
val ys6: Seq[Int] = xs6
@@ -65,7 +65,7 @@ object Test {
6565
val y3: Int = x3
6666
val x4 = xs.head
6767
val y4: Int = x4
68-
val x5 = xs.collectAs(List)
68+
val x5 = xs.to(List)
6969
val y5: List[Int] = x5
7070
val (xs6, xs7) = xs.partition(_ % 2 == 0)
7171
val ys6: View[Int] = xs6
@@ -92,16 +92,16 @@ object Test {
9292
println(x3)
9393
println(x4)
9494
println(x5)
95-
println(xs6.collectAs(List))
96-
println(xs7.collectAs(List))
97-
println(xs8.collectAs(List))
98-
println(xs9.collectAs(List))
99-
println(xs10.collectAs(List))
100-
println(xs11.collectAs(List))
101-
println(xs12.collectAs(List))
102-
println(xs13.collectAs(List))
103-
println(xs14.collectAs(List))
104-
println(xs15.collectAs(List))
95+
println(xs6.to(List))
96+
println(xs7.to(List))
97+
println(xs8.to(List))
98+
println(xs9.to(List))
99+
println(xs10.to(List))
100+
println(xs11.to(List))
101+
println(xs12.to(List))
102+
println(xs13.to(List))
103+
println(xs14.to(List))
104+
println(xs15.to(List))
105105
}
106106

107107
def stringOps(xs: String) = {
@@ -113,7 +113,7 @@ object Test {
113113
val y3: Int = x3
114114
val x4 = xs.head
115115
val y4: Int = x4
116-
val x5 = xs.collectAs(List)
116+
val x5 = xs.to(List)
117117
val y5: List[Char] = x5
118118
val (xs6, xs7) = xs.partition(_ % 2 == 0)
119119
val ys6: String = xs6
@@ -160,7 +160,7 @@ object Test {
160160

161161
def main(args: Array[String]) = {
162162
val ints = Cons(1, Cons(2, Cons(3, Nil)))
163-
val intsBuf = ints.collectAs(ArrayBuffer)
163+
val intsBuf = ints.to(ArrayBuffer)
164164
val intsView = ints.view
165165
seqOps(ints)
166166
seqOps(intsBuf)

0 commit comments

Comments
 (0)