@@ -114,13 +114,13 @@ object CollectionStrawMan1 {
114
114
/* --------- Concrete collection types ------------------------------- */
115
115
116
116
/** Concrete collection type: List */
117
- sealed trait List [+ A ] extends Seq [A ] with FromIterator [List ] {
117
+ sealed trait List [type + Elem ] extends Seq [Elem ] with FromIterator [List ] {
118
118
def isEmpty : Boolean
119
- def head : A
120
- def tail : List [A ]
121
- def iterator = new ListIterator [A ](this )
119
+ def head : Elem
120
+ def tail : List [Elem ]
121
+ def iterator = new ListIterator [Elem ](this )
122
122
def fromIterator [B ](it : Iterator [B ]): List [B ] = List .fromIterator(it)
123
- def apply (i : Int ): A = {
123
+ def apply (i : Int ): Elem = {
124
124
require(! isEmpty)
125
125
if (i == 0 ) head else tail.apply(i - 1 )
126
126
}
@@ -155,17 +155,17 @@ object CollectionStrawMan1 {
155
155
}
156
156
157
157
/** Concrete collection type: ArrayBuffer */
158
- class ArrayBuffer [A ] private (initElems : Array [AnyRef ], initLength : Int ) extends Seq [A ] with FromIterator [ArrayBuffer ] {
158
+ class ArrayBuffer [type Elem ] private (initElems : Array [AnyRef ], initLength : Int ) extends Seq [Elem ] with FromIterator [ArrayBuffer ] {
159
159
def this () = this (new Array [AnyRef ](16 ), 0 )
160
160
private var elems : Array [AnyRef ] = initElems
161
161
private var start = 0
162
162
private var limit = initLength
163
- def apply (i : Int ) = elems(start + i).asInstanceOf [A ]
163
+ def apply (i : Int ) = elems(start + i).asInstanceOf [Elem ]
164
164
def length = limit - start
165
- def iterator = new ArrayBufferIterator [A ](elems, start, length)
165
+ def iterator = new ArrayBufferIterator [Elem ](elems, start, length)
166
166
def fromIterator [B ](it : Iterator [B ]): ArrayBuffer [B ] =
167
167
ArrayBuffer .fromIterator(it)
168
- def += (elem : A ): this .type = {
168
+ def += (elem : Elem ): this .type = {
169
169
if (limit == elems.length) {
170
170
if (start > 0 ) {
171
171
Array .copy(elems, start, elems, 0 , length)
@@ -213,7 +213,7 @@ object CollectionStrawMan1 {
213
213
}
214
214
215
215
/** Concrete collection type: View */
216
- class View [+ A ](it : => Iterator [A ]) extends CanIterate [A ] {
216
+ class View [type + Elem ](it : => Iterator [Elem ]) extends CanIterate [Elem ] {
217
217
def iterator = it
218
218
}
219
219
0 commit comments