| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // patch classes for Int8List ..... Float64List and ByteData implementations. | 5 // patch classes for Int8List ..... Float64List and ByteData implementations. |
| 6 | 6 |
| 7 patch class Int8List { | 7 patch class Int8List { |
| 8 /* patch */ factory Int8List(int length) { | 8 /* patch */ factory Int8List(int length) { |
| 9 return new _Int8Array(length); | 9 return new _Int8Array(length); |
| 10 } | 10 } |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 344 } |
| 345 | 345 |
| 346 num lastWhere(bool test(num element), {orElse()}) { | 346 num lastWhere(bool test(num element), {orElse()}) { |
| 347 return IterableMixinWorkaround.lastWhereList(this, test, orElse); | 347 return IterableMixinWorkaround.lastWhereList(this, test, orElse); |
| 348 } | 348 } |
| 349 | 349 |
| 350 num singleWhere(bool test(num element)) { | 350 num singleWhere(bool test(num element)) { |
| 351 return IterableMixinWorkaround.singleWhere(this, test); | 351 return IterableMixinWorkaround.singleWhere(this, test); |
| 352 } | 352 } |
| 353 | 353 |
| 354 Iterable<num> get reversed { |
| 355 return IterableMixinWorkaround.reversedList(this); |
| 356 } |
| 357 |
| 354 num elementAt(int index) { | 358 num elementAt(int index) { |
| 355 return this[index]; | 359 return this[index]; |
| 356 } | 360 } |
| 357 | 361 |
| 358 bool get isEmpty { | 362 bool get isEmpty { |
| 359 return this.length == 0; | 363 return this.length == 0; |
| 360 } | 364 } |
| 361 | 365 |
| 362 bool get isNotEmpty => !isEmpty; | 366 bool get isNotEmpty => !isEmpty; |
| 363 | 367 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 471 } |
| 468 | 472 |
| 469 List toList({bool growable: true}) { | 473 List toList({bool growable: true}) { |
| 470 return new List.from(this, growable: growable); | 474 return new List.from(this, growable: growable); |
| 471 } | 475 } |
| 472 | 476 |
| 473 Set toSet() { | 477 Set toSet() { |
| 474 return new Set.from(this); | 478 return new Set.from(this); |
| 475 } | 479 } |
| 476 | 480 |
| 481 Map<int, num> asMap() { |
| 482 return IterableMixinWorkaround.asMapList(this); |
| 483 } |
| 484 |
| 477 List sublist(int start, [int end]) { | 485 List sublist(int start, [int end]) { |
| 478 if (end == null) end = length; | 486 if (end == null) end = length; |
| 479 int length = end - start; | 487 int length = end - start; |
| 480 _rangeCheck(this.length, start, length); | 488 _rangeCheck(this.length, start, length); |
| 481 List result = _createList(length); | 489 List result = _createList(length); |
| 482 result.setRange(0, length, this, start); | 490 result.setRange(0, length, this, start); |
| 483 return result; | 491 return result; |
| 484 } | 492 } |
| 485 | 493 |
| 486 Iterable getRange(int start, [int end]) { | 494 Iterable getRange(int start, [int end]) { |
| (...skipping 2873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3360 return value; | 3368 return value; |
| 3361 } | 3369 } |
| 3362 return object; | 3370 return object; |
| 3363 } | 3371 } |
| 3364 | 3372 |
| 3365 | 3373 |
| 3366 void _throwRangeError(int index, int length) { | 3374 void _throwRangeError(int index, int length) { |
| 3367 String message = "$index must be in the range [0..$length)"; | 3375 String message = "$index must be in the range [0..$length)"; |
| 3368 throw new RangeError(message); | 3376 throw new RangeError(message); |
| 3369 } | 3377 } |
| OLD | NEW |