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

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

Issue 12086062: Rename mappedBy to map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months 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 5
6 // TODO(srdjan): Use shared array implementation. 6 // TODO(srdjan): Use shared array implementation.
7 class _ObjectArray<E> implements List<E> { 7 class _ObjectArray<E> implements List<E> {
8 8
9 factory _ObjectArray(int length) native "ObjectArray_allocate"; 9 factory _ObjectArray(int length) native "ObjectArray_allocate";
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 92
93 void forEach(f(E element)) { 93 void forEach(f(E element)) {
94 IterableMixinWorkaround.forEach(this, f); 94 IterableMixinWorkaround.forEach(this, f);
95 } 95 }
96 96
97 String join([String separator]) { 97 String join([String separator]) {
98 return IterableMixinWorkaround.joinList(this, separator); 98 return IterableMixinWorkaround.joinList(this, separator);
99 } 99 }
100 100
101 List mappedBy(f(E element)) { 101 Iterable map(f(E element)) {
floitsch 2013/01/30 14:48:44 map should return an iterable right away (since th
Lasse Reichstein Nielsen 2013/01/30 16:58:01 Do you mean that map should return an element that
Lasse Reichstein Nielsen 2013/01/31 11:33:49 Ok, changed all List.mappedBy implementations to r
102 return IterableMixinWorkaround.mappedByList(this, f); 102 return IterableMixinWorkaround.mappedByList(this, f);
103 } 103 }
104 104
105 Iterable mappedBy(f(E element)) => map(f);
106
105 reduce(initialValue, combine(previousValue, E element)) { 107 reduce(initialValue, combine(previousValue, E element)) {
106 return IterableMixinWorkaround.reduce(this, initialValue, combine); 108 return IterableMixinWorkaround.reduce(this, initialValue, combine);
107 } 109 }
108 110
109 Iterable<E> where(bool f(E element)) { 111 Iterable<E> where(bool f(E element)) {
110 return IterableMixinWorkaround.where(this, f); 112 return IterableMixinWorkaround.where(this, f);
111 } 113 }
112 114
113 List<E> take(int n) { 115 Iterable<E> take(int n) {
114 return IterableMixinWorkaround.takeList(this, n); 116 return IterableMixinWorkaround.takeList(this, n);
115 } 117 }
116 118
117 Iterable<E> takeWhile(bool test(E value)) { 119 Iterable<E> takeWhile(bool test(E value)) {
118 return IterableMixinWorkaround.takeWhile(this, test); 120 return IterableMixinWorkaround.takeWhile(this, test);
119 } 121 }
120 122
121 List<E> skip(int n) { 123 Iterable<E> skip(int n) {
122 return IterableMixinWorkaround.skipList(this, n); 124 return IterableMixinWorkaround.skipList(this, n);
123 } 125 }
124 126
125 Iterable<E> skipWhile(bool test(E value)) { 127 Iterable<E> skipWhile(bool test(E value)) {
126 return IterableMixinWorkaround.skipWhile(this, test); 128 return IterableMixinWorkaround.skipWhile(this, test);
127 } 129 }
128 130
129 bool every(bool f(E element)) { 131 bool every(bool f(E element)) {
130 return IterableMixinWorkaround.every(this, f); 132 return IterableMixinWorkaround.every(this, f);
131 } 133 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // Collection interface. 319 // Collection interface.
318 320
319 bool contains(E element) { 321 bool contains(E element) {
320 return IterableMixinWorkaround.contains(this, element); 322 return IterableMixinWorkaround.contains(this, element);
321 } 323 }
322 324
323 void forEach(f(E element)) { 325 void forEach(f(E element)) {
324 IterableMixinWorkaround.forEach(this, f); 326 IterableMixinWorkaround.forEach(this, f);
325 } 327 }
326 328
327 List mappedBy(f(E element)) { 329 Iterable map(f(E element)) {
floitsch 2013/01/30 14:48:44 ditto.
Lasse Reichstein Nielsen 2013/01/31 11:33:49 Done.
328 return IterableMixinWorkaround.mappedByList(this, f); 330 return IterableMixinWorkaround.mappedByList(this, f);
329 } 331 }
330 332
333 Iterable mappedBy(f(E element)) => map(f);
334
331 String join([String separator]) { 335 String join([String separator]) {
332 return IterableMixinWorkaround.joinList(this, separator); 336 return IterableMixinWorkaround.joinList(this, separator);
333 } 337 }
334 338
335 reduce(initialValue, combine(previousValue, E element)) { 339 reduce(initialValue, combine(previousValue, E element)) {
336 return IterableMixinWorkaround.reduce(this, initialValue, combine); 340 return IterableMixinWorkaround.reduce(this, initialValue, combine);
337 } 341 }
338 342
339 Iterable<E> where(bool f(E element)) { 343 Iterable<E> where(bool f(E element)) {
340 return IterableMixinWorkaround.where(this, f); 344 return IterableMixinWorkaround.where(this, f);
341 } 345 }
342 346
343 List<E> take(int n) { 347 Iterable<E> take(int n) {
344 return IterableMixinWorkaround.takeList(this, n); 348 return IterableMixinWorkaround.takeList(this, n);
345 } 349 }
346 350
347 Iterable<E> takeWhile(bool test(E value)) { 351 Iterable<E> takeWhile(bool test(E value)) {
348 return IterableMixinWorkaround.takeWhile(this, test); 352 return IterableMixinWorkaround.takeWhile(this, test);
349 } 353 }
350 354
351 List<E> skip(int n) { 355 Iterable<E> skip(int n) {
352 return IterableMixinWorkaround.skipList(this, n); 356 return IterableMixinWorkaround.skipList(this, n);
353 } 357 }
354 358
355 Iterable<E> skipWhile(bool test(E value)) { 359 Iterable<E> skipWhile(bool test(E value)) {
356 return IterableMixinWorkaround.skipWhile(this, test); 360 return IterableMixinWorkaround.skipWhile(this, test);
357 } 361 }
358 362
359 bool every(bool f(E element)) { 363 bool every(bool f(E element)) {
360 return IterableMixinWorkaround.every(this, f); 364 return IterableMixinWorkaround.every(this, f);
361 } 365 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 492 }
489 _position = _length; 493 _position = _length;
490 _current = null; 494 _current = null;
491 return false; 495 return false;
492 } 496 }
493 497
494 E get current { 498 E get current {
495 return _current; 499 return _current;
496 } 500 }
497 } 501 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698