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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 abstract class _ByteArrayBase { | 117 abstract class _ByteArrayBase { |
118 abstract int lengthInBytes(); | 118 abstract int lengthInBytes(); |
119 | 119 |
120 abstract int bytesPerElement(); | 120 abstract int bytesPerElement(); |
121 | 121 |
122 abstract operator[](int index); | 122 abstract operator[](int index); |
123 | 123 |
124 // Methods implementing the Collection interface. | 124 // Methods implementing the Collection interface. |
125 | 125 |
| 126 bool contains(element) => Collections.contains(this, element); |
| 127 |
126 void forEach(void f(element)) { | 128 void forEach(void f(element)) { |
127 var len = this.length; | 129 var len = this.length; |
128 for (var i = 0; i < len; i++) { | 130 for (var i = 0; i < len; i++) { |
129 f(this[i]); | 131 f(this[i]); |
130 } | 132 } |
131 } | 133 } |
132 | 134 |
133 Collection map(f(element)) { | 135 Collection map(f(element)) { |
134 return Collections.map(this, new List(), f); | 136 return Collections.map(this, new List(), f); |
135 } | 137 } |
(...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2409 } | 2411 } |
2410 _rangeCheck(this.length, start, length); | 2412 _rangeCheck(this.length, start, length); |
2411 return _array.subByteArray(_offset + start, length); | 2413 return _array.subByteArray(_offset + start, length); |
2412 } | 2414 } |
2413 | 2415 |
2414 static const int _BYTES_PER_ELEMENT = 8; | 2416 static const int _BYTES_PER_ELEMENT = 8; |
2415 final ByteArray _array; | 2417 final ByteArray _array; |
2416 final int _offset; | 2418 final int _offset; |
2417 final int _length; | 2419 final int _length; |
2418 } | 2420 } |
OLD | NEW |