| 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 /** | 5 /** |
| 6 * A random-access sequence of bytes that also provides random access to | 6 * A random-access sequence of bytes that also provides random access to |
| 7 * the fixed-width integers and floating point numbers represented by | 7 * the fixed-width integers and floating point numbers represented by |
| 8 * those bytes. Byte arrays may be used to pack and unpack data from | 8 * those bytes. Byte arrays may be used to pack and unpack data from |
| 9 * external sources (such as networks or files systems), and to process | 9 * external sources (such as networks or files systems), and to process |
| 10 * large quantities of numerical data more efficiently than would be possible | 10 * large quantities of numerical data more efficiently than would be possible |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 f(this[i]); | 805 f(this[i]); |
| 806 } | 806 } |
| 807 } | 807 } |
| 808 | 808 |
| 809 Collection map(f(element)) { | 809 Collection map(f(element)) { |
| 810 return Collections.map(this, | 810 return Collections.map(this, |
| 811 new GrowableObjectArray.withCapacity(length), | 811 new GrowableObjectArray.withCapacity(length), |
| 812 f); | 812 f); |
| 813 } | 813 } |
| 814 | 814 |
| 815 Dynamic reduce(Dynamic initialValue, |
| 816 Dynamic combine(Dynamic initialValue, element)) { |
| 817 return Collections.reduce(this, initialValue, combine); |
| 818 } |
| 819 |
| 815 Collection filter(bool f(element)) { | 820 Collection filter(bool f(element)) { |
| 816 return Collections.filter(this, new GrowableObjectArray(), f); | 821 return Collections.filter(this, new GrowableObjectArray(), f); |
| 817 } | 822 } |
| 818 | 823 |
| 819 bool every(bool f(element)) { | 824 bool every(bool f(element)) { |
| 820 return Collections.every(this, f); | 825 return Collections.every(this, f); |
| 821 } | 826 } |
| 822 | 827 |
| 823 bool some(bool f(element)) { | 828 bool some(bool f(element)) { |
| 824 return Collections.some(this, f); | 829 return Collections.some(this, f); |
| (...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2279 f(this[i]); | 2284 f(this[i]); |
| 2280 } | 2285 } |
| 2281 } | 2286 } |
| 2282 | 2287 |
| 2283 Collection map(f(element)) { | 2288 Collection map(f(element)) { |
| 2284 return Collections.map(this, | 2289 return Collections.map(this, |
| 2285 new GrowableObjectArray.withCapacity(length), | 2290 new GrowableObjectArray.withCapacity(length), |
| 2286 f); | 2291 f); |
| 2287 } | 2292 } |
| 2288 | 2293 |
| 2294 Dynamic reduce(Dynamic initialValue, |
| 2295 Dynamic combine(Dynamic initialValue, element)) { |
| 2296 return Collections.reduce(this, initialValue, combine); |
| 2297 } |
| 2298 |
| 2289 Collection filter(bool f(element)) { | 2299 Collection filter(bool f(element)) { |
| 2290 return Collections.filter(this, new GrowableObjectArray(), f); | 2300 return Collections.filter(this, new GrowableObjectArray(), f); |
| 2291 } | 2301 } |
| 2292 | 2302 |
| 2293 bool every(bool f(element)) { | 2303 bool every(bool f(element)) { |
| 2294 return Collections.every(this, f); | 2304 return Collections.every(this, f); |
| 2295 } | 2305 } |
| 2296 | 2306 |
| 2297 bool some(bool f(element)) { | 2307 bool some(bool f(element)) { |
| 2298 return Collections.some(this, f);; | 2308 return Collections.some(this, f);; |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3076 } | 3086 } |
| 3077 _rangeCheck(this.length, start, length); | 3087 _rangeCheck(this.length, start, length); |
| 3078 return _array.subByteArray(_offset + start, length); | 3088 return _array.subByteArray(_offset + start, length); |
| 3079 } | 3089 } |
| 3080 | 3090 |
| 3081 static final int _BYTES_PER_ELEMENT = 8; | 3091 static final int _BYTES_PER_ELEMENT = 8; |
| 3082 final ByteArray _array; | 3092 final ByteArray _array; |
| 3083 final int _offset; | 3093 final int _offset; |
| 3084 final int _length; | 3094 final int _length; |
| 3085 } | 3095 } |
| OLD | NEW |