Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: runtime/lib/byte_array.dart

Issue 11412086: Make 'where' lazy. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: FilteredIterable/Iterator -> WhereIterable/Iterator. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 Iterable mappedBy(f(element)) { 135 Iterable mappedBy(f(element)) {
136 return new MappedIterable<int, dynamic>(this, f); 136 return new MappedIterable<int, dynamic>(this, f);
137 } 137 }
138 138
139 Dynamic reduce(Dynamic initialValue, 139 Dynamic reduce(Dynamic initialValue,
140 Dynamic combine(Dynamic initialValue, element)) { 140 Dynamic combine(Dynamic initialValue, element)) {
141 return Collections.reduce(this, initialValue, combine); 141 return Collections.reduce(this, initialValue, combine);
142 } 142 }
143 143
144 Collection where(bool f(element)) { 144 Collection where(bool f(element)) {
145 return Collections.where(this, new List(), f); 145 return new WhereIterable<int>(this, f);
146 } 146 }
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
(...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 } 2402 }
2403 _rangeCheck(this.length, start, length); 2403 _rangeCheck(this.length, start, length);
2404 return _array.subByteArray(_offset + start, length); 2404 return _array.subByteArray(_offset + start, length);
2405 } 2405 }
2406 2406
2407 static const int _BYTES_PER_ELEMENT = 8; 2407 static const int _BYTES_PER_ELEMENT = 8;
2408 final ByteArray _array; 2408 final ByteArray _array;
2409 final int _offset; 2409 final int _offset;
2410 final int _length; 2410 final int _length;
2411 } 2411 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698