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

Side by Side Diff: lib/html/templates/immutable_list_mixin.darttemplate

Issue 11169004: Add "contains" method to Collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed last illegal-access Created 8 years, 2 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 | « lib/html/templates/html/impl/impl_NodeList.darttemplate ('k') | runtime/lib/array.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 // -- start List<$E> mixins. 1 // -- start List<$E> mixins.
2 // $E is the element type. 2 // $E is the element type.
3 3
4 // From Iterable<$E>: 4 // From Iterable<$E>:
5 5
6 Iterator<$E> iterator() { 6 Iterator<$E> iterator() {
7 // Note: NodeLists are not fixed size. And most probably length shouldn't 7 // Note: NodeLists are not fixed size. And most probably length shouldn't
8 // be cached in both iterator _and_ forEach method. For now caching it 8 // be cached in both iterator _and_ forEach method. For now caching it
9 // for consistency. 9 // for consistency.
10 return new _FixedSizeListIterator<$E>(this); 10 return new _FixedSizeListIterator<$E>(this);
11 } 11 }
12 12
13 // From Collection<$E>: 13 // From Collection<$E>:
14 14
15 void add($E value) { 15 void add($E value) {
16 throw const UnsupportedOperationException("Cannot add to immutable List."); 16 throw const UnsupportedOperationException("Cannot add to immutable List.");
17 } 17 }
18 18
19 void addLast($E value) { 19 void addLast($E value) {
20 throw const UnsupportedOperationException("Cannot add to immutable List."); 20 throw const UnsupportedOperationException("Cannot add to immutable List.");
21 } 21 }
22 22
23 void addAll(Collection<$E> collection) { 23 void addAll(Collection<$E> collection) {
24 throw const UnsupportedOperationException("Cannot add to immutable List."); 24 throw const UnsupportedOperationException("Cannot add to immutable List.");
25 } 25 }
26 26
27 bool contains($E element) => _Collections.contains(this, element);
28
27 void forEach(void f($E element)) => _Collections.forEach(this, f); 29 void forEach(void f($E element)) => _Collections.forEach(this, f);
28 30
29 Collection map(f($E element)) => _Collections.map(this, [], f); 31 Collection map(f($E element)) => _Collections.map(this, [], f);
30 32
31 Collection<$E> filter(bool f($E element)) => 33 Collection<$E> filter(bool f($E element)) =>
32 _Collections.filter(this, <$E>[], f); 34 _Collections.filter(this, <$E>[], f);
33 35
34 bool every(bool f($E element)) => _Collections.every(this, f); 36 bool every(bool f($E element)) => _Collections.every(this, f);
35 37
36 bool some(bool f($E element)) => _Collections.some(this, f); 38 bool some(bool f($E element)) => _Collections.some(this, f);
(...skipping 29 matching lines...) Expand all
66 } 68 }
67 69
68 void insertRange(int start, int rangeLength, [$E initialValue]) { 70 void insertRange(int start, int rangeLength, [$E initialValue]) {
69 throw const UnsupportedOperationException("Cannot insertRange on immutable L ist."); 71 throw const UnsupportedOperationException("Cannot insertRange on immutable L ist.");
70 } 72 }
71 73
72 List<$E> getRange(int start, int rangeLength) => 74 List<$E> getRange(int start, int rangeLength) =>
73 _Lists.getRange(this, start, rangeLength, <$E>[]); 75 _Lists.getRange(this, start, rangeLength, <$E>[]);
74 76
75 // -- end List<$E> mixins. 77 // -- end List<$E> mixins.
OLDNEW
« no previous file with comments | « lib/html/templates/html/impl/impl_NodeList.darttemplate ('k') | runtime/lib/array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698