| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 } | 298 } |
| 299 | 299 |
| 300 bool every(bool f(element)) { | 300 bool every(bool f(element)) { |
| 301 return IterableMixinWorkaround.every(this, f); | 301 return IterableMixinWorkaround.every(this, f); |
| 302 } | 302 } |
| 303 | 303 |
| 304 bool any(bool f(element)) { | 304 bool any(bool f(element)) { |
| 305 return IterableMixinWorkaround.any(this, f); | 305 return IterableMixinWorkaround.any(this, f); |
| 306 } | 306 } |
| 307 | 307 |
| 308 int firstMatching(bool test(int value), {int orElse()}) { | 308 int firstWhere(bool test(int value), {int orElse()}) { |
| 309 return IterableMixinWorkaround.firstMatching(this, test, orElse); | 309 return IterableMixinWorkaround.firstWhere(this, test, orElse); |
| 310 } | 310 } |
| 311 | 311 |
| 312 int lastMatching(bool test(int value), {int orElse()}) { | 312 int lastWhere(bool test(int value), {int orElse()}) { |
| 313 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse); | 313 return IterableMixinWorkaround.lastWhereList(this, test, orElse); |
| 314 } | 314 } |
| 315 | 315 |
| 316 int singleMatching(bool test(int value)) { | 316 int singleWhere(bool test(int value)) { |
| 317 return IterableMixinWorkaround.singleMatching(this, test); | 317 return IterableMixinWorkaround.singleWhere(this, test); |
| 318 } | 318 } |
| 319 | 319 |
| 320 int elementAt(int index) { | 320 int elementAt(int index) { |
| 321 return this[index]; | 321 return this[index]; |
| 322 } | 322 } |
| 323 | 323 |
| 324 bool get isEmpty { | 324 bool get isEmpty { |
| 325 return this.length == 0; | 325 return this.length == 0; |
| 326 } | 326 } |
| 327 | 327 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 void removeAll(Iterable elements) { | 377 void removeAll(Iterable elements) { |
| 378 throw new UnsupportedError( | 378 throw new UnsupportedError( |
| 379 "Cannot remove from a non-extendable array"); | 379 "Cannot remove from a non-extendable array"); |
| 380 } | 380 } |
| 381 | 381 |
| 382 void retainAll(Iterable elements) { | 382 void retainAll(Iterable elements) { |
| 383 throw new UnsupportedError( | 383 throw new UnsupportedError( |
| 384 "Cannot remove from a non-extendable array"); | 384 "Cannot remove from a non-extendable array"); |
| 385 } | 385 } |
| 386 | 386 |
| 387 void removeMatching(bool test(int element)) { | 387 void removeWhere(bool test(int element)) { |
| 388 throw new UnsupportedError( | 388 throw new UnsupportedError( |
| 389 "Cannot remove from a non-extendable array"); | 389 "Cannot remove from a non-extendable array"); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void retainMatching(bool test(int element)) { | 392 void retainWhere(bool test(int element)) { |
| 393 throw new UnsupportedError( | 393 throw new UnsupportedError( |
| 394 "Cannot remove from a non-extendable array"); | 394 "Cannot remove from a non-extendable array"); |
| 395 } | 395 } |
| 396 | 396 |
| 397 int get first { | 397 int get first { |
| 398 if (length > 0) return this[0]; | 398 if (length > 0) return this[0]; |
| 399 throw new StateError("No elements"); | 399 throw new StateError("No elements"); |
| 400 } | 400 } |
| 401 | 401 |
| 402 int get last { | 402 int get last { |
| (...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 } | 2481 } |
| 2482 } | 2482 } |
| 2483 | 2483 |
| 2484 | 2484 |
| 2485 int _defaultIfNull(object, value) { | 2485 int _defaultIfNull(object, value) { |
| 2486 if (object == null) { | 2486 if (object == null) { |
| 2487 return value; | 2487 return value; |
| 2488 } | 2488 } |
| 2489 return object; | 2489 return object; |
| 2490 } | 2490 } |
| OLD | NEW |