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

Side by Side Diff: compiler/lib/implementation/array.dart

Issue 9114021: Added method map to Collection interface and all its implementations (except classes generated fr... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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
« no previous file with comments | « client/samples/swarm/DataSource.dart ('k') | compiler/lib/implementation/collections.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class ListFactory<E> { 5 class ListFactory<E> {
6 factory List.from(Iterable<E> other) { 6 factory List.from(Iterable<E> other) {
7 if (other == null) { 7 if (other == null) {
8 throw const NullPointerException(); 8 throw const NullPointerException();
9 } 9 }
10 List<E> list = new List<E>(); 10 List<E> list = new List<E>();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 int get length() native; 69 int get length() native;
70 void _setLength(int length) native; 70 void _setLength(int length) native;
71 void _add(T value) native; 71 void _add(T value) native;
72 void _removeRange(int start, int length) native; 72 void _removeRange(int start, int length) native;
73 void _insertRange(int start, int length, T initialValue) native; 73 void _insertRange(int start, int length, T initialValue) native;
74 74
75 void forEach(void f(T element)) { 75 void forEach(void f(T element)) {
76 Collections.forEach(this, f); 76 Collections.forEach(this, f);
77 } 77 }
78 78
79 Collection map(f(T element)) {
80 return Collections.map(this, new List(), f);
81 }
82
79 Collection<T> filter(bool f(T element)) { 83 Collection<T> filter(bool f(T element)) {
80 return Collections.filter(this, new List<T>(), f); 84 return Collections.filter(this, new List<T>(), f);
81 } 85 }
82 86
83 bool every(bool f(T element)) { 87 bool every(bool f(T element)) {
84 return Collections.every(this, f); 88 return Collections.every(this, f);
85 } 89 }
86 90
87 bool some(bool f(T element)) { 91 bool some(bool f(T element)) {
88 return Collections.some(this, f); 92 return Collections.some(this, f);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 269 }
266 270
267 static List _newList(int len) native { 271 static List _newList(int len) native {
268 return new List(len); 272 return new List(len);
269 } 273 }
270 274
271 static void _throwIndexOutOfRangeException(int index) native { 275 static void _throwIndexOutOfRangeException(int index) native {
272 throw new IndexOutOfRangeException(index); 276 throw new IndexOutOfRangeException(index);
273 } 277 }
274 } 278 }
OLDNEW
« no previous file with comments | « client/samples/swarm/DataSource.dart ('k') | compiler/lib/implementation/collections.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698