OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #library("dart:coreimpl"); | 5 #library("dart:coreimpl"); |
6 | 6 |
7 #source("../../corelib/src/implementation/dual_pivot_quicksort.dart"); | 7 #source("../../corelib/src/implementation/dual_pivot_quicksort.dart"); |
8 #source("../../corelib/src/implementation/duration_implementation.dart"); | 8 #source("../../corelib/src/implementation/duration_implementation.dart"); |
9 #source("../../corelib/src/implementation/exceptions.dart"); | 9 #source("../../corelib/src/implementation/exceptions.dart"); |
10 #source("../../corelib/src/implementation/future_implementation.dart"); | 10 #source("../../corelib/src/implementation/future_implementation.dart"); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 void clear() { length = 0; } | 61 void clear() { length = 0; } |
62 | 62 |
63 E removeLast() native "return this.pop();"; | 63 E removeLast() native "return this.pop();"; |
64 | 64 |
65 E last() => this[this.length-1]; | 65 E last() => this[this.length-1]; |
66 | 66 |
67 List<E> getRange(int start, int length) native | 67 List<E> getRange(int start, int length) native |
68 "return this.slice(start, start + length);"; | 68 "return this.slice(start, start + length);"; |
69 | 69 |
70 void setRange(int start, int length, List<E> from, [int startFrom]) native; | 70 void setRange(int start, int length, List<E> from, [int startFrom]) native; |
71 void removeRange(int start, int length) native; | 71 void removeRange(int start, int length) native "this.splice(start, length);"; |
72 void insertRange(int start, int length, [E initialValue]) native; | 72 |
| 73 void insertRange(int start, int length, [E initialValue]) native |
| 74 """ |
| 75 // Splice in the values with a minimum of array allocations. |
| 76 var args = new Array(length + 2); |
| 77 args[0] = start; |
| 78 args[1] = 0; |
| 79 for (var i = 0; i < length; i++) { |
| 80 args[i + 2] = initialValue; |
| 81 } |
| 82 this.splice.apply(this, args); |
| 83 """; |
73 | 84 |
74 // Collection<E> members: | 85 // Collection<E> members: |
75 void forEach(void f(E element)) native; | 86 void forEach(void f(E element)) native; |
76 Collection<E> filter(bool f(E element)) native; | 87 Collection<E> filter(bool f(E element)) native; |
77 bool every(bool f(E element)) native; | 88 bool every(bool f(E element)) native; |
78 bool some(bool f(E element)) native; | 89 bool some(bool f(E element)) native; |
79 bool isEmpty() => length == 0; | 90 bool isEmpty() => length == 0; |
80 | 91 |
81 // Iterable<E> members: | 92 // Iterable<E> members: |
82 Iterator<E> iterator() => new ListIterator(this); | 93 Iterator<E> iterator() => new ListIterator(this); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } else if (isNaN()) { | 423 } else if (isNaN()) { |
413 if (other.isNaN()) { | 424 if (other.isNaN()) { |
414 return 0; | 425 return 0; |
415 } | 426 } |
416 return 1; | 427 return 1; |
417 } else { | 428 } else { |
418 return -1; | 429 return -1; |
419 } | 430 } |
420 } | 431 } |
421 } | 432 } |
OLD | NEW |