@@ -137,13 +137,13 @@ trait TraversableViewLike[+A,
137
137
* on it. Used for those operations which do not naturally lend themselves to a view
138
138
*/
139
139
trait ForcedT [B ] extends TransformedT [B ] {
140
- protected [this ] val forced : GenSeq [B ]
140
+ protected [this ] lazy val forced : GenSeq [B ]
141
141
def foreach [U ](f : B => U ) = forced foreach f
142
142
final override protected [this ] def viewIdentifier = " C"
143
143
}
144
144
145
145
trait SlicedT extends TransformedT [A ] {
146
- protected [this ] val endpoints : SliceInterval
146
+ protected [this ] lazy val endpoints : SliceInterval
147
147
protected [this ] def from = endpoints.from
148
148
protected [this ] def until = endpoints.until
149
149
// protected def newSliced(_endpoints: SliceInterval): TransformedT[A] =
@@ -163,7 +163,7 @@ trait TraversableViewLike[+A,
163
163
}
164
164
165
165
trait MappedT [B ] extends TransformedT [B ] {
166
- protected [this ] val mapping : A => B
166
+ protected [this ] lazy val mapping : A => B
167
167
def foreach [U ](f : B => U ) {
168
168
for (x <- self)
169
169
f(mapping(x))
@@ -172,7 +172,7 @@ trait TraversableViewLike[+A,
172
172
}
173
173
174
174
trait FlatMappedT [B ] extends TransformedT [B ] {
175
- protected [this ] val mapping : A => GenTraversableOnce [B ]
175
+ protected [this ] lazy val mapping : A => GenTraversableOnce [B ]
176
176
def foreach [U ](f : B => U ) {
177
177
for (x <- self)
178
178
for (y <- mapping(x).seq)
@@ -182,7 +182,7 @@ trait TraversableViewLike[+A,
182
182
}
183
183
184
184
trait AppendedT [B >: A ] extends TransformedT [B ] {
185
- protected [this ] val rest : GenTraversable [B ]
185
+ protected [this ] lazy val rest : GenTraversable [B ]
186
186
def foreach [U ](f : B => U ) {
187
187
self foreach f
188
188
rest foreach f
@@ -191,7 +191,7 @@ trait TraversableViewLike[+A,
191
191
}
192
192
193
193
trait FilteredT extends TransformedT [A ] {
194
- protected [this ] val pred : A => Boolean
194
+ protected [this ] lazy val pred : A => Boolean
195
195
def foreach [U ](f : A => U ) {
196
196
for (x <- self)
197
197
if (pred(x)) f(x)
@@ -200,7 +200,7 @@ trait TraversableViewLike[+A,
200
200
}
201
201
202
202
trait TakenWhileT extends TransformedT [A ] {
203
- protected [this ] val pred : A => Boolean
203
+ protected [this ] lazy val pred : A => Boolean
204
204
def foreach [U ](f : A => U ) {
205
205
for (x <- self) {
206
206
if (! pred(x)) return
@@ -211,7 +211,7 @@ trait TraversableViewLike[+A,
211
211
}
212
212
213
213
trait DroppedWhileT extends TransformedT [A ] {
214
- protected [this ] val pred : A => Boolean
214
+ protected [this ] lazy val pred : A => Boolean
215
215
def foreach [U ](f : A => U ) {
216
216
var go = false
217
217
for (x <- self) {
0 commit comments