OLD | NEW |
1 part of dart.collection; | 1 part of dart.collection; |
2 abstract class IterableMixin<E> implements Iterable<E> {Iterable map(f(E elemen
t)) => new MappedIterable<E, dynamic>(this, f); | 2 abstract class IterableMixin<E> implements Iterable<E> {Iterable map(f(E elemen
t)) => new MappedIterable<E, dynamic>(this, f); |
3 Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f); | 3 Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f); |
4 Iterable expand(Iterable f(E element)) => new ExpandIterable<E, dynamic>(this,
f); | 4 Iterable expand(Iterable f(E element)) => new ExpandIterable<E, dynamic>(this,
f); |
5 bool contains(Object element) { | 5 bool contains(Object element) { |
6 for (E e in this) { | 6 for (E e in this) { |
7 if (e == element) return true; | 7 if (e == element) return true; |
8 } | 8 } |
9 return false; | 9 return false; |
10 } | 10 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 return new SkipIterable<E>(this, n); | 81 return new SkipIterable<E>(this, n); |
82 } | 82 } |
83 Iterable<E> skipWhile(bool test(E value)) { | 83 Iterable<E> skipWhile(bool test(E value)) { |
84 return new SkipWhileIterable<E>(this, test); | 84 return new SkipWhileIterable<E>(this, test); |
85 } | 85 } |
86 E get first { | 86 E get first { |
87 Iterator it = iterator; | 87 Iterator it = iterator; |
88 if (!it.moveNext()) { | 88 if (!it.moveNext()) { |
89 throw IterableElementError.noElement(); | 89 throw IterableElementError.noElement(); |
90 } | 90 } |
91 return DEVC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 127, colum
n 12 of dart:collection/iterable.dart: """, it.current is E, false); | 91 return DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 127, col
umn 12 of dart:collection/iterable.dart: """, it.current is E, false); |
92 } | 92 } |
93 E get last { | 93 E get last { |
94 Iterator it = iterator; | 94 Iterator it = iterator; |
95 if (!it.moveNext()) { | 95 if (!it.moveNext()) { |
96 throw IterableElementError.noElement(); | 96 throw IterableElementError.noElement(); |
97 } | 97 } |
98 E result; | 98 E result; |
99 do { | 99 do { |
100 result = DEVC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 137, co
lumn 16 of dart:collection/iterable.dart: """, it.current is E, false); | 100 result = DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 137,
column 16 of dart:collection/iterable.dart: """, it.current is E, false); |
101 } | 101 } |
102 while (it.moveNext()); return result; | 102 while (it.moveNext()); return result; |
103 } | 103 } |
104 E get single { | 104 E get single { |
105 Iterator it = iterator; | 105 Iterator it = iterator; |
106 if (!it.moveNext()) throw IterableElementError.noElement(); | 106 if (!it.moveNext()) throw IterableElementError.noElement(); |
107 E result = DEVC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 145, c
olumn 16 of dart:collection/iterable.dart: """, it.current is E, false); | 107 E result = DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 145,
column 16 of dart:collection/iterable.dart: """, it.current is E, false); |
108 if (it.moveNext()) throw IterableElementError.tooMany(); | 108 if (it.moveNext()) throw IterableElementError.tooMany(); |
109 return result; | 109 return result; |
110 } | 110 } |
111 E firstWhere(bool test(E value), { | 111 E firstWhere(bool test(E value), { |
112 E orElse()} | 112 E orElse()} |
113 ) { | 113 ) { |
114 for (E element in this) { | 114 for (E element in this) { |
115 if (test(element)) return element; | 115 if (test(element)) return element; |
116 } | 116 } |
117 if (orElse != null) return orElse(); | 117 if (orElse != null) return orElse(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 return new SkipIterable<E>(this, n); | 242 return new SkipIterable<E>(this, n); |
243 } | 243 } |
244 Iterable<E> skipWhile(bool test(E value)) { | 244 Iterable<E> skipWhile(bool test(E value)) { |
245 return new SkipWhileIterable<E>(this, test); | 245 return new SkipWhileIterable<E>(this, test); |
246 } | 246 } |
247 E get first { | 247 E get first { |
248 Iterator it = iterator; | 248 Iterator it = iterator; |
249 if (!it.moveNext()) { | 249 if (!it.moveNext()) { |
250 throw IterableElementError.noElement(); | 250 throw IterableElementError.noElement(); |
251 } | 251 } |
252 return DEVC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 323, column
12 of dart:collection/iterable.dart: """, it.current is E, false); | 252 return DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 323, colum
n 12 of dart:collection/iterable.dart: """, it.current is E, false); |
253 } | 253 } |
254 E get last { | 254 E get last { |
255 Iterator it = iterator; | 255 Iterator it = iterator; |
256 if (!it.moveNext()) { | 256 if (!it.moveNext()) { |
257 throw IterableElementError.noElement(); | 257 throw IterableElementError.noElement(); |
258 } | 258 } |
259 E result; | 259 E result; |
260 do { | 260 do { |
261 result = DEVC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 333, colu
mn 16 of dart:collection/iterable.dart: """, it.current is E, false); | 261 result = DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 333, co
lumn 16 of dart:collection/iterable.dart: """, it.current is E, false); |
262 } | 262 } |
263 while (it.moveNext()); return result; | 263 while (it.moveNext()); return result; |
264 } | 264 } |
265 E get single { | 265 E get single { |
266 Iterator it = iterator; | 266 Iterator it = iterator; |
267 if (!it.moveNext()) throw IterableElementError.noElement(); | 267 if (!it.moveNext()) throw IterableElementError.noElement(); |
268 E result = DEVC$RT.cast(it.current, dynamic, E, "CastGeneral", """line 341, col
umn 16 of dart:collection/iterable.dart: """, it.current is E, false); | 268 E result = DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 341, c
olumn 16 of dart:collection/iterable.dart: """, it.current is E, false); |
269 if (it.moveNext()) throw IterableElementError.tooMany(); | 269 if (it.moveNext()) throw IterableElementError.tooMany(); |
270 return result; | 270 return result; |
271 } | 271 } |
272 E firstWhere(bool test(E value), { | 272 E firstWhere(bool test(E value), { |
273 E orElse()} | 273 E orElse()} |
274 ) { | 274 ) { |
275 for (E element in this) { | 275 for (E element in this) { |
276 if (test(element)) return element; | 276 if (test(element)) return element; |
277 } | 277 } |
278 if (orElse != null) return orElse(); | 278 if (orElse != null) return orElse(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 if (!it.moveNext()) return; String next = "${it.current}"; | 372 if (!it.moveNext()) return; String next = "${it.current}"; |
373 parts.add(next); | 373 parts.add(next); |
374 length += next.length + OVERHEAD; | 374 length += next.length + OVERHEAD; |
375 count++; | 375 count++; |
376 } | 376 } |
377 String penultimateString; | 377 String penultimateString; |
378 String ultimateString; | 378 String ultimateString; |
379 var penultimate = null; | 379 var penultimate = null; |
380 var ultimate = null; | 380 var ultimate = null; |
381 if (!it.moveNext()) { | 381 if (!it.moveNext()) { |
382 if (count <= HEAD_COUNT + TAIL_COUNT) return; ultimateString = ((__x0) => DEVC
$RT.cast(__x0, dynamic, String, "CastGeneral", """line 530, column 24 of dart:co
llection/iterable.dart: """, __x0 is String, true))(parts.removeLast()); | 382 if (count <= HEAD_COUNT + TAIL_COUNT) return; ultimateString = ((__x0) => DEVC
$RT.cast(__x0, dynamic, String, "DynamicCast", """line 530, column 24 of dart:co
llection/iterable.dart: """, __x0 is String, true))(parts.removeLast()); |
383 penultimateString = ((__x1) => DEVC$RT.cast(__x1, dynamic, String, "CastGener
al", """line 531, column 27 of dart:collection/iterable.dart: """, __x1 is Strin
g, true))(parts.removeLast()); | 383 penultimateString = ((__x1) => DEVC$RT.cast(__x1, dynamic, String, "DynamicCa
st", """line 531, column 27 of dart:collection/iterable.dart: """, __x1 is Strin
g, true))(parts.removeLast()); |
384 } | 384 } |
385 else { | 385 else { |
386 penultimate = it.current; | 386 penultimate = it.current; |
387 count++; | 387 count++; |
388 if (!it.moveNext()) { | 388 if (!it.moveNext()) { |
389 if (count <= HEAD_COUNT + 1) { | 389 if (count <= HEAD_COUNT + 1) { |
390 parts.add("$penultimate"); | 390 parts.add("$penultimate"); |
391 return;} | 391 return;} |
392 ultimateString = "$penultimate"; | 392 ultimateString = "$penultimate"; |
393 penultimateString = ((__x2) => DEVC$RT.cast(__x2, dynamic, String, "CastGen
eral", """line 541, column 29 of dart:collection/iterable.dart: """, __x2 is Str
ing, true))(parts.removeLast()); | 393 penultimateString = ((__x2) => DEVC$RT.cast(__x2, dynamic, String, "Dynamic
Cast", """line 541, column 29 of dart:collection/iterable.dart: """, __x2 is Str
ing, true))(parts.removeLast()); |
394 length += ultimateString.length + OVERHEAD; | 394 length += ultimateString.length + OVERHEAD; |
395 } | 395 } |
396 else { | 396 else { |
397 ultimate = it.current; | 397 ultimate = it.current; |
398 count++; | 398 count++; |
399 assert (count < MAX_COUNT); while (it.moveNext()) { | 399 assert (count < MAX_COUNT); while (it.moveNext()) { |
400 penultimate = ultimate; | 400 penultimate = ultimate; |
401 ultimate = it.current; | 401 ultimate = it.current; |
402 count++; | 402 count++; |
403 if (count > MAX_COUNT) { | 403 if (count > MAX_COUNT) { |
404 while (length > LENGTH_LIMIT - ELLIPSIS_SIZE - OVERHEAD && count > HEAD_
COUNT) { | 404 while (length > LENGTH_LIMIT - ELLIPSIS_SIZE - OVERHEAD && count > HEAD_
COUNT) { |
405 length -= ((__x3) => DEVC$RT.cast(__x3, dynamic, int, "CastGeneral", "
""line 562, column 25 of dart:collection/iterable.dart: """, __x3 is int, true))
(parts.removeLast().length + OVERHEAD); | 405 length -= ((__x3) => DEVC$RT.cast(__x3, dynamic, int, "DynamicCast", "
""line 562, column 25 of dart:collection/iterable.dart: """, __x3 is int, true))
(parts.removeLast().length + OVERHEAD); |
406 count--; | 406 count--; |
407 } | 407 } |
408 parts.add("..."); | 408 parts.add("..."); |
409 return;} | 409 return;} |
410 } | 410 } |
411 penultimateString = "$penultimate"; | 411 penultimateString = "$penultimate"; |
412 ultimateString = "$ultimate"; | 412 ultimateString = "$ultimate"; |
413 length += ultimateString.length + penultimateString.length + 2 * OVERHEAD; | 413 length += ultimateString.length + penultimateString.length + 2 * OVERHEAD; |
414 } | 414 } |
415 } | 415 } |
416 String elision = null; | 416 String elision = null; |
417 if (count > parts.length + TAIL_COUNT) { | 417 if (count > parts.length + TAIL_COUNT) { |
418 elision = "..."; | 418 elision = "..."; |
419 length += ELLIPSIS_SIZE + OVERHEAD; | 419 length += ELLIPSIS_SIZE + OVERHEAD; |
420 } | 420 } |
421 while (length > LENGTH_LIMIT && parts.length > HEAD_COUNT) { | 421 while (length > LENGTH_LIMIT && parts.length > HEAD_COUNT) { |
422 length -= ((__x4) => DEVC$RT.cast(__x4, dynamic, int, "CastGeneral", """line 5
88, column 17 of dart:collection/iterable.dart: """, __x4 is int, true))(parts.r
emoveLast().length + OVERHEAD); | 422 length -= ((__x4) => DEVC$RT.cast(__x4, dynamic, int, "DynamicCast", """line 5
88, column 17 of dart:collection/iterable.dart: """, __x4 is int, true))(parts.r
emoveLast().length + OVERHEAD); |
423 if (elision == null) { | 423 if (elision == null) { |
424 elision = "..."; | 424 elision = "..."; |
425 length += ELLIPSIS_SIZE + OVERHEAD; | 425 length += ELLIPSIS_SIZE + OVERHEAD; |
426 } | 426 } |
427 } | 427 } |
428 if (elision != null) { | 428 if (elision != null) { |
429 parts.add(elision); | 429 parts.add(elision); |
430 } | 430 } |
431 parts.add(penultimateString); | 431 parts.add(penultimateString); |
432 parts.add(ultimateString); | 432 parts.add(ultimateString); |
433 } | 433 } |
434 } | 434 } |
OLD | NEW |