| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 class Int8List { | 5 patch class Int8List { |
| 6 /* patch */ factory Int8List(int length) { | 6 /* patch */ factory Int8List(int length) { |
| 7 return new _Int8Array(length); | 7 return new _Int8Array(length); |
| 8 } | 8 } |
| 9 | 9 |
| 10 /* patch */ factory Int8List.view(ByteArray array, | 10 /* patch */ factory Int8List.view(ByteArray array, |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 bool every(bool f(element)) { | 148 bool every(bool f(element)) { |
| 149 return Collections.every(this, f); | 149 return Collections.every(this, f); |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool some(bool f(element)) { | 152 bool some(bool f(element)) { |
| 153 return Collections.some(this, f); | 153 return Collections.some(this, f); |
| 154 } | 154 } |
| 155 | 155 |
| 156 bool get isEmpty { | 156 bool get isEmpty { |
| 157 return this.length === 0; | 157 return this.length == 0; |
| 158 } | 158 } |
| 159 | 159 |
| 160 int get length { | 160 int get length { |
| 161 return _length(); | 161 return _length(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 // Methods implementing the List interface. | 164 // Methods implementing the List interface. |
| 165 | 165 |
| 166 set length(newLength) { | 166 set length(newLength) { |
| 167 throw new UnsupportedError( | 167 throw new UnsupportedError( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 185 | 185 |
| 186 void sort([Comparator compare = Comparable.compare]) { | 186 void sort([Comparator compare = Comparable.compare]) { |
| 187 coreSort(this, compare); | 187 coreSort(this, compare); |
| 188 } | 188 } |
| 189 | 189 |
| 190 int indexOf(element, [int start = 0]) { | 190 int indexOf(element, [int start = 0]) { |
| 191 return Arrays.indexOf(this, element, start, this.length); | 191 return Arrays.indexOf(this, element, start, this.length); |
| 192 } | 192 } |
| 193 | 193 |
| 194 int lastIndexOf(element, [int start = null]) { | 194 int lastIndexOf(element, [int start = null]) { |
| 195 if (start === null) start = length - 1; | 195 if (start == null) start = length - 1; |
| 196 return Arrays.lastIndexOf(this, element, start); | 196 return Arrays.lastIndexOf(this, element, start); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void clear() { | 199 void clear() { |
| 200 throw new UnsupportedError( | 200 throw new UnsupportedError( |
| 201 "Cannot remove from a non-extendable array"); | 201 "Cannot remove from a non-extendable array"); |
| 202 } | 202 } |
| 203 | 203 |
| 204 int removeLast() { | 204 int removeLast() { |
| 205 throw new UnsupportedError( | 205 throw new UnsupportedError( |
| 206 "Cannot remove from a non-extendable array"); | 206 "Cannot remove from a non-extendable array"); |
| 207 } | 207 } |
| 208 | 208 |
| 209 get last { | 209 get last { |
| 210 return this[length - 1]; | 210 return this[length - 1]; |
| 211 } | 211 } |
| 212 | 212 |
| 213 void removeRange(int start, int length) { | 213 void removeRange(int start, int length) { |
| 214 throw new UnsupportedError( | 214 throw new UnsupportedError( |
| 215 "Cannot remove from a non-extendable array"); | 215 "Cannot remove from a non-extendable array"); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void insertRange(int start, int length, [initialValue]) { | 218 void insertRange(int start, int length, [initialValue]) { |
| 219 throw new UnsupportedError( | 219 throw new UnsupportedError( |
| 220 "Cannot add to a non-extendable array"); | 220 "Cannot add to a non-extendable array"); |
| 221 } | 221 } |
| 222 | 222 |
| 223 ByteArray asByteArray([int start = 0, int length]) { | 223 ByteArray asByteArray([int start = 0, int length]) { |
| 224 if (length === null) { | 224 if (length == null) { |
| 225 length = this.length; | 225 length = this.length; |
| 226 } | 226 } |
| 227 _rangeCheck(this.length, start, length); | 227 _rangeCheck(this.length, start, length); |
| 228 return new _ByteArrayView(this, | 228 return new _ByteArrayView(this, |
| 229 start * this.bytesPerElement(), | 229 start * this.bytesPerElement(), |
| 230 length * this.bytesPerElement()); | 230 length * this.bytesPerElement()); |
| 231 } | 231 } |
| 232 | 232 |
| 233 int _length() native "ByteArray_getLength"; | 233 int _length() native "ByteArray_getLength"; |
| 234 | 234 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return object; | 324 return object; |
| 325 } | 325 } |
| 326 throw new ArgumentError("$object is not an integer"); | 326 throw new ArgumentError("$object is not an integer"); |
| 327 } | 327 } |
| 328 | 328 |
| 329 | 329 |
| 330 int _requireIntegerOrNull(object, value) { | 330 int _requireIntegerOrNull(object, value) { |
| 331 if (object is int) { | 331 if (object is int) { |
| 332 return object; | 332 return object; |
| 333 } | 333 } |
| 334 if (object === null) { | 334 if (object == null) { |
| 335 return _requireInteger(value); | 335 return _requireInteger(value); |
| 336 } | 336 } |
| 337 throw new ArgumentError("$object is not an integer or null"); | 337 throw new ArgumentError("$object is not an integer or null"); |
| 338 } | 338 } |
| 339 | 339 |
| 340 | 340 |
| 341 class _Int8Array extends _ByteArrayBase implements Int8List { | 341 class _Int8Array extends _ByteArrayBase implements Int8List { |
| 342 factory _Int8Array(int length) { | 342 factory _Int8Array(int length) { |
| 343 return _new(length); | 343 return _new(length); |
| 344 } | 344 } |
| 345 | 345 |
| 346 factory _Int8Array.view(ByteArray array, [int start = 0, int length]) { | 346 factory _Int8Array.view(ByteArray array, [int start = 0, int length]) { |
| 347 if (length === null) { | 347 if (length == null) { |
| 348 length = array.lengthInBytes(); | 348 length = array.lengthInBytes(); |
| 349 } | 349 } |
| 350 return new _Int8ArrayView(array, start, length); | 350 return new _Int8ArrayView(array, start, length); |
| 351 } | 351 } |
| 352 | 352 |
| 353 int operator[](int index) { | 353 int operator[](int index) { |
| 354 return _getIndexed(index); | 354 return _getIndexed(index); |
| 355 } | 355 } |
| 356 | 356 |
| 357 int operator[]=(int index, int value) { | 357 int operator[]=(int index, int value) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 int _setIndexed(int index, int value) native "Int8Array_setIndexed"; | 400 int _setIndexed(int index, int value) native "Int8Array_setIndexed"; |
| 401 } | 401 } |
| 402 | 402 |
| 403 | 403 |
| 404 class _Uint8Array extends _ByteArrayBase implements Uint8List { | 404 class _Uint8Array extends _ByteArrayBase implements Uint8List { |
| 405 factory _Uint8Array(int length) { | 405 factory _Uint8Array(int length) { |
| 406 return _new(length); | 406 return _new(length); |
| 407 } | 407 } |
| 408 | 408 |
| 409 factory _Uint8Array.view(ByteArray array, [int start = 0, int length]) { | 409 factory _Uint8Array.view(ByteArray array, [int start = 0, int length]) { |
| 410 if (length === null) { | 410 if (length == null) { |
| 411 length = array.lengthInBytes(); | 411 length = array.lengthInBytes(); |
| 412 } | 412 } |
| 413 return new _Uint8ArrayView(array, start, length); | 413 return new _Uint8ArrayView(array, start, length); |
| 414 } | 414 } |
| 415 | 415 |
| 416 int operator[](int index) { | 416 int operator[](int index) { |
| 417 return _getIndexed(index); | 417 return _getIndexed(index); |
| 418 } | 418 } |
| 419 | 419 |
| 420 int operator[]=(int index, int value) { | 420 int operator[]=(int index, int value) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 int _setIndexed(int index, int value) native "Uint8Array_setIndexed"; | 463 int _setIndexed(int index, int value) native "Uint8Array_setIndexed"; |
| 464 } | 464 } |
| 465 | 465 |
| 466 | 466 |
| 467 class _Int16Array extends _ByteArrayBase implements Int16List { | 467 class _Int16Array extends _ByteArrayBase implements Int16List { |
| 468 factory _Int16Array(int length) { | 468 factory _Int16Array(int length) { |
| 469 return _new(length); | 469 return _new(length); |
| 470 } | 470 } |
| 471 | 471 |
| 472 factory _Int16Array.view(ByteArray array, [int start = 0, int length]) { | 472 factory _Int16Array.view(ByteArray array, [int start = 0, int length]) { |
| 473 if (length === null) { | 473 if (length == null) { |
| 474 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; | 474 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; |
| 475 } | 475 } |
| 476 return new _Int16ArrayView(array, start, length); | 476 return new _Int16ArrayView(array, start, length); |
| 477 } | 477 } |
| 478 | 478 |
| 479 int operator[](int index) { | 479 int operator[](int index) { |
| 480 return _getIndexed(index); | 480 return _getIndexed(index); |
| 481 } | 481 } |
| 482 | 482 |
| 483 int operator[]=(int index, int value) { | 483 int operator[]=(int index, int value) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 int _setIndexed(int index, int value) native "Int16Array_setIndexed"; | 526 int _setIndexed(int index, int value) native "Int16Array_setIndexed"; |
| 527 } | 527 } |
| 528 | 528 |
| 529 | 529 |
| 530 class _Uint16Array extends _ByteArrayBase implements Uint16List { | 530 class _Uint16Array extends _ByteArrayBase implements Uint16List { |
| 531 factory _Uint16Array(int length) { | 531 factory _Uint16Array(int length) { |
| 532 return _new(length); | 532 return _new(length); |
| 533 } | 533 } |
| 534 | 534 |
| 535 factory _Uint16Array.view(ByteArray array, [int start = 0, int length]) { | 535 factory _Uint16Array.view(ByteArray array, [int start = 0, int length]) { |
| 536 if (length === null) { | 536 if (length == null) { |
| 537 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; | 537 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; |
| 538 } | 538 } |
| 539 return new _Uint16ArrayView(array, start, length); | 539 return new _Uint16ArrayView(array, start, length); |
| 540 } | 540 } |
| 541 | 541 |
| 542 int operator[](int index) { | 542 int operator[](int index) { |
| 543 return _getIndexed(index); | 543 return _getIndexed(index); |
| 544 } | 544 } |
| 545 | 545 |
| 546 int operator[]=(int index, int value) { | 546 int operator[]=(int index, int value) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 int _setIndexed(int index, int value) native "Uint16Array_setIndexed"; | 589 int _setIndexed(int index, int value) native "Uint16Array_setIndexed"; |
| 590 } | 590 } |
| 591 | 591 |
| 592 | 592 |
| 593 class _Int32Array extends _ByteArrayBase implements Int32List { | 593 class _Int32Array extends _ByteArrayBase implements Int32List { |
| 594 factory _Int32Array(int length) { | 594 factory _Int32Array(int length) { |
| 595 return _new(length); | 595 return _new(length); |
| 596 } | 596 } |
| 597 | 597 |
| 598 factory _Int32Array.view(ByteArray array, [int start = 0, int length]) { | 598 factory _Int32Array.view(ByteArray array, [int start = 0, int length]) { |
| 599 if (length === null) { | 599 if (length == null) { |
| 600 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; | 600 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; |
| 601 } | 601 } |
| 602 return new _Int32ArrayView(array, start, length); | 602 return new _Int32ArrayView(array, start, length); |
| 603 } | 603 } |
| 604 | 604 |
| 605 int operator[](int index) { | 605 int operator[](int index) { |
| 606 return _getIndexed(index); | 606 return _getIndexed(index); |
| 607 } | 607 } |
| 608 | 608 |
| 609 int operator[]=(int index, int value) { | 609 int operator[]=(int index, int value) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 int _setIndexed(int index, int value) native "Int32Array_setIndexed"; | 652 int _setIndexed(int index, int value) native "Int32Array_setIndexed"; |
| 653 } | 653 } |
| 654 | 654 |
| 655 | 655 |
| 656 class _Uint32Array extends _ByteArrayBase implements Uint32List { | 656 class _Uint32Array extends _ByteArrayBase implements Uint32List { |
| 657 factory _Uint32Array(int length) { | 657 factory _Uint32Array(int length) { |
| 658 return _new(length); | 658 return _new(length); |
| 659 } | 659 } |
| 660 | 660 |
| 661 factory _Uint32Array.view(ByteArray array, [int start = 0, int length]) { | 661 factory _Uint32Array.view(ByteArray array, [int start = 0, int length]) { |
| 662 if (length === null) { | 662 if (length == null) { |
| 663 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; | 663 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; |
| 664 } | 664 } |
| 665 return new _Uint32ArrayView(array, start, length); | 665 return new _Uint32ArrayView(array, start, length); |
| 666 } | 666 } |
| 667 | 667 |
| 668 int operator[](int index) { | 668 int operator[](int index) { |
| 669 return _getIndexed(index); | 669 return _getIndexed(index); |
| 670 } | 670 } |
| 671 | 671 |
| 672 int operator[]=(int index, int value) { | 672 int operator[]=(int index, int value) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 int _setIndexed(int index, int value) native "Uint32Array_setIndexed"; | 715 int _setIndexed(int index, int value) native "Uint32Array_setIndexed"; |
| 716 } | 716 } |
| 717 | 717 |
| 718 | 718 |
| 719 class _Int64Array extends _ByteArrayBase implements Int64List { | 719 class _Int64Array extends _ByteArrayBase implements Int64List { |
| 720 factory _Int64Array(int length) { | 720 factory _Int64Array(int length) { |
| 721 return _new(length); | 721 return _new(length); |
| 722 } | 722 } |
| 723 | 723 |
| 724 factory _Int64Array.view(ByteArray array, [int start = 0, int length]) { | 724 factory _Int64Array.view(ByteArray array, [int start = 0, int length]) { |
| 725 if (length === null) { | 725 if (length == null) { |
| 726 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; | 726 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; |
| 727 } | 727 } |
| 728 return new _Int64ArrayView(array, start, length); | 728 return new _Int64ArrayView(array, start, length); |
| 729 } | 729 } |
| 730 | 730 |
| 731 int operator[](int index) { | 731 int operator[](int index) { |
| 732 return _getIndexed(index); | 732 return _getIndexed(index); |
| 733 } | 733 } |
| 734 | 734 |
| 735 int operator[]=(int index, int value) { | 735 int operator[]=(int index, int value) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 int _setIndexed(int index, int value) native "Int64Array_setIndexed"; | 778 int _setIndexed(int index, int value) native "Int64Array_setIndexed"; |
| 779 } | 779 } |
| 780 | 780 |
| 781 | 781 |
| 782 class _Uint64Array extends _ByteArrayBase implements Uint64List { | 782 class _Uint64Array extends _ByteArrayBase implements Uint64List { |
| 783 factory _Uint64Array(int length) { | 783 factory _Uint64Array(int length) { |
| 784 return _new(length); | 784 return _new(length); |
| 785 } | 785 } |
| 786 | 786 |
| 787 factory _Uint64Array.view(ByteArray array, [int start = 0, int length]) { | 787 factory _Uint64Array.view(ByteArray array, [int start = 0, int length]) { |
| 788 if (length === null) { | 788 if (length == null) { |
| 789 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; | 789 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; |
| 790 } | 790 } |
| 791 return new _Uint64ArrayView(array, start, length); | 791 return new _Uint64ArrayView(array, start, length); |
| 792 } | 792 } |
| 793 | 793 |
| 794 int operator[](int index) { | 794 int operator[](int index) { |
| 795 return _getIndexed(index); | 795 return _getIndexed(index); |
| 796 } | 796 } |
| 797 | 797 |
| 798 int operator[]=(int index, int value) { | 798 int operator[]=(int index, int value) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 int _setIndexed(int index, int value) native "Uint64Array_setIndexed"; | 841 int _setIndexed(int index, int value) native "Uint64Array_setIndexed"; |
| 842 } | 842 } |
| 843 | 843 |
| 844 | 844 |
| 845 class _Float32Array extends _ByteArrayBase implements Float32List { | 845 class _Float32Array extends _ByteArrayBase implements Float32List { |
| 846 factory _Float32Array(int length) { | 846 factory _Float32Array(int length) { |
| 847 return _new(length); | 847 return _new(length); |
| 848 } | 848 } |
| 849 | 849 |
| 850 factory _Float32Array.view(ByteArray array, [int start = 0, int length]) { | 850 factory _Float32Array.view(ByteArray array, [int start = 0, int length]) { |
| 851 if (length === null) { | 851 if (length == null) { |
| 852 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; | 852 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; |
| 853 } | 853 } |
| 854 return new _Float32ArrayView(array, start, length); | 854 return new _Float32ArrayView(array, start, length); |
| 855 } | 855 } |
| 856 | 856 |
| 857 double operator[](int index) { | 857 double operator[](int index) { |
| 858 return _getIndexed(index); | 858 return _getIndexed(index); |
| 859 } | 859 } |
| 860 | 860 |
| 861 int operator[]=(int index, double value) { | 861 int operator[]=(int index, double value) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 int _setIndexed(int index, double value) native "Float32Array_setIndexed"; | 904 int _setIndexed(int index, double value) native "Float32Array_setIndexed"; |
| 905 } | 905 } |
| 906 | 906 |
| 907 | 907 |
| 908 class _Float64Array extends _ByteArrayBase implements Float64List { | 908 class _Float64Array extends _ByteArrayBase implements Float64List { |
| 909 factory _Float64Array(int length) { | 909 factory _Float64Array(int length) { |
| 910 return _new(length); | 910 return _new(length); |
| 911 } | 911 } |
| 912 | 912 |
| 913 factory _Float64Array.view(ByteArray array, [int start = 0, int length]) { | 913 factory _Float64Array.view(ByteArray array, [int start = 0, int length]) { |
| 914 if (length === null) { | 914 if (length == null) { |
| 915 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; | 915 length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; |
| 916 } | 916 } |
| 917 return new _Float64ArrayView(array, start, length); | 917 return new _Float64ArrayView(array, start, length); |
| 918 } | 918 } |
| 919 | 919 |
| 920 double operator[](int index) { | 920 double operator[](int index) { |
| 921 return _getIndexed(index); | 921 return _getIndexed(index); |
| 922 } | 922 } |
| 923 | 923 |
| 924 int operator[]=(int index, double value) { | 924 int operator[]=(int index, double value) { |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 _ByteArrayView(this._array, this._offset, this._length) { | 1509 _ByteArrayView(this._array, this._offset, this._length) { |
| 1510 _rangeCheck(_array.lengthInBytes(), _offset, _length); | 1510 _rangeCheck(_array.lengthInBytes(), _offset, _length); |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 int lengthInBytes() { | 1513 int lengthInBytes() { |
| 1514 return _length; | 1514 return _length; |
| 1515 } | 1515 } |
| 1516 | 1516 |
| 1517 ByteArray subByteArray([int start = 0, int length]) { | 1517 ByteArray subByteArray([int start = 0, int length]) { |
| 1518 if (start is! int) throw new ArgumentError("start is not an int"); | 1518 if (start is! int) throw new ArgumentError("start is not an int"); |
| 1519 if (length === null) { | 1519 if (length == null) { |
| 1520 length = this.lengthInBytes() - start; | 1520 length = this.lengthInBytes() - start; |
| 1521 } else if (length is! int) { | 1521 } else if (length is! int) { |
| 1522 throw new ArgumentError("length is not an int"); | 1522 throw new ArgumentError("length is not an int"); |
| 1523 } | 1523 } |
| 1524 return new _ByteArrayView(_array, _offset + start, length); | 1524 return new _ByteArrayView(_array, _offset + start, length); |
| 1525 } | 1525 } |
| 1526 | 1526 |
| 1527 int getInt8(int byteOffset) { | 1527 int getInt8(int byteOffset) { |
| 1528 return _array._getInt8(_offset + byteOffset); | 1528 return _array._getInt8(_offset + byteOffset); |
| 1529 } | 1529 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 | 1627 |
| 1628 bool every(bool f(element)) { | 1628 bool every(bool f(element)) { |
| 1629 return Collections.every(this, f); | 1629 return Collections.every(this, f); |
| 1630 } | 1630 } |
| 1631 | 1631 |
| 1632 bool some(bool f(element)) { | 1632 bool some(bool f(element)) { |
| 1633 return Collections.some(this, f);; | 1633 return Collections.some(this, f);; |
| 1634 } | 1634 } |
| 1635 | 1635 |
| 1636 bool get isEmpty { | 1636 bool get isEmpty { |
| 1637 return this.length === 0; | 1637 return this.length == 0; |
| 1638 } | 1638 } |
| 1639 | 1639 |
| 1640 abstract int get length; | 1640 abstract int get length; |
| 1641 | 1641 |
| 1642 // Methods implementing the List interface. | 1642 // Methods implementing the List interface. |
| 1643 | 1643 |
| 1644 set length(newLength) { | 1644 set length(newLength) { |
| 1645 throw new UnsupportedError( | 1645 throw new UnsupportedError( |
| 1646 "Cannot resize a non-extendable array"); | 1646 "Cannot resize a non-extendable array"); |
| 1647 } | 1647 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1663 | 1663 |
| 1664 void sort([Comparator compare = Comparable.compare]) { | 1664 void sort([Comparator compare = Comparable.compare]) { |
| 1665 coreSort(this, compare); | 1665 coreSort(this, compare); |
| 1666 } | 1666 } |
| 1667 | 1667 |
| 1668 int indexOf(element, [int start = 0]) { | 1668 int indexOf(element, [int start = 0]) { |
| 1669 return Arrays.indexOf(this, element, start, this.length); | 1669 return Arrays.indexOf(this, element, start, this.length); |
| 1670 } | 1670 } |
| 1671 | 1671 |
| 1672 int lastIndexOf(element, [int start = null]) { | 1672 int lastIndexOf(element, [int start = null]) { |
| 1673 if (start === null) start = length - 1; | 1673 if (start == null) start = length - 1; |
| 1674 return Arrays.lastIndexOf(this, element, start); | 1674 return Arrays.lastIndexOf(this, element, start); |
| 1675 } | 1675 } |
| 1676 | 1676 |
| 1677 void clear() { | 1677 void clear() { |
| 1678 throw new UnsupportedError( | 1678 throw new UnsupportedError( |
| 1679 "Cannot remove from a non-extendable array"); | 1679 "Cannot remove from a non-extendable array"); |
| 1680 } | 1680 } |
| 1681 | 1681 |
| 1682 int removeLast() { | 1682 int removeLast() { |
| 1683 throw new UnsupportedError( | 1683 throw new UnsupportedError( |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2411 } | 2411 } |
| 2412 _rangeCheck(this.length, start, length); | 2412 _rangeCheck(this.length, start, length); |
| 2413 return _array.subByteArray(_offset + start, length); | 2413 return _array.subByteArray(_offset + start, length); |
| 2414 } | 2414 } |
| 2415 | 2415 |
| 2416 static const int _BYTES_PER_ELEMENT = 8; | 2416 static const int _BYTES_PER_ELEMENT = 8; |
| 2417 final ByteArray _array; | 2417 final ByteArray _array; |
| 2418 final int _offset; | 2418 final int _offset; |
| 2419 final int _length; | 2419 final int _length; |
| 2420 } | 2420 } |
| OLD | NEW |