| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Methods implementing the Collection interface. | 124 // Methods implementing the Collection interface. |
| 125 | 125 |
| 126 void forEach(void f(element)) { | 126 void forEach(void f(element)) { |
| 127 var len = this.length; | 127 var len = this.length; |
| 128 for (var i = 0; i < len; i++) { | 128 for (var i = 0; i < len; i++) { |
| 129 f(this[i]); | 129 f(this[i]); |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 Collection map(f(element)) { | 133 Collection map(f(element)) { |
| 134 return Collections.map(this, | 134 return Collections.map(this, new List(), f); |
| 135 new GrowableObjectArray.withCapacity(length), | |
| 136 f); | |
| 137 } | 135 } |
| 138 | 136 |
| 139 Dynamic reduce(Dynamic initialValue, | 137 Dynamic reduce(Dynamic initialValue, |
| 140 Dynamic combine(Dynamic initialValue, element)) { | 138 Dynamic combine(Dynamic initialValue, element)) { |
| 141 return Collections.reduce(this, initialValue, combine); | 139 return Collections.reduce(this, initialValue, combine); |
| 142 } | 140 } |
| 143 | 141 |
| 144 Collection filter(bool f(element)) { | 142 Collection filter(bool f(element)) { |
| 145 return Collections.filter(this, new GrowableObjectArray(), f); | 143 return Collections.filter(this, new List(), f); |
| 146 } | 144 } |
| 147 | 145 |
| 148 bool every(bool f(element)) { | 146 bool every(bool f(element)) { |
| 149 return Collections.every(this, f); | 147 return Collections.every(this, f); |
| 150 } | 148 } |
| 151 | 149 |
| 152 bool some(bool f(element)) { | 150 bool some(bool f(element)) { |
| 153 return Collections.some(this, f); | 151 return Collections.some(this, f); |
| 154 } | 152 } |
| 155 | 153 |
| (...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 // Methods implementing the Collection interface. | 1601 // Methods implementing the Collection interface. |
| 1604 | 1602 |
| 1605 void forEach(void f(element)) { | 1603 void forEach(void f(element)) { |
| 1606 var len = this.length; | 1604 var len = this.length; |
| 1607 for (var i = 0; i < len; i++) { | 1605 for (var i = 0; i < len; i++) { |
| 1608 f(this[i]); | 1606 f(this[i]); |
| 1609 } | 1607 } |
| 1610 } | 1608 } |
| 1611 | 1609 |
| 1612 Collection map(f(element)) { | 1610 Collection map(f(element)) { |
| 1613 return Collections.map(this, | 1611 return Collections.map(this, new List(), f); |
| 1614 new GrowableObjectArray.withCapacity(length), | |
| 1615 f); | |
| 1616 } | 1612 } |
| 1617 | 1613 |
| 1618 Dynamic reduce(Dynamic initialValue, | 1614 Dynamic reduce(Dynamic initialValue, |
| 1619 Dynamic combine(Dynamic initialValue, element)) { | 1615 Dynamic combine(Dynamic initialValue, element)) { |
| 1620 return Collections.reduce(this, initialValue, combine); | 1616 return Collections.reduce(this, initialValue, combine); |
| 1621 } | 1617 } |
| 1622 | 1618 |
| 1623 Collection filter(bool f(element)) { | 1619 Collection filter(bool f(element)) { |
| 1624 return Collections.filter(this, new GrowableObjectArray(), f); | 1620 return Collections.filter(this, new List(), f); |
| 1625 } | 1621 } |
| 1626 | 1622 |
| 1627 bool every(bool f(element)) { | 1623 bool every(bool f(element)) { |
| 1628 return Collections.every(this, f); | 1624 return Collections.every(this, f); |
| 1629 } | 1625 } |
| 1630 | 1626 |
| 1631 bool some(bool f(element)) { | 1627 bool some(bool f(element)) { |
| 1632 return Collections.some(this, f);; | 1628 return Collections.some(this, f);; |
| 1633 } | 1629 } |
| 1634 | 1630 |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2410 } | 2406 } |
| 2411 _rangeCheck(this.length, start, length); | 2407 _rangeCheck(this.length, start, length); |
| 2412 return _array.subByteArray(_offset + start, length); | 2408 return _array.subByteArray(_offset + start, length); |
| 2413 } | 2409 } |
| 2414 | 2410 |
| 2415 static const int _BYTES_PER_ELEMENT = 8; | 2411 static const int _BYTES_PER_ELEMENT = 8; |
| 2416 final ByteArray _array; | 2412 final ByteArray _array; |
| 2417 final int _offset; | 2413 final int _offset; |
| 2418 final int _length; | 2414 final int _length; |
| 2419 } | 2415 } |
| OLD | NEW |