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

Side by Side Diff: tools/dom/src/WrappedList.dart

Issue 12391046: Add List.asMap(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 9 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.dom.html; 5 part of dart.dom.html;
6 6
7 /** 7 /**
8 * A list which just wraps another list, for either intercepting list calls or 8 * A list which just wraps another list, for either intercepting list calls or
9 * retyping the list (for example, from List<A> to List<B> where B extends A). 9 * retyping the list (for example, from List<A> to List<B> where B extends A).
10 */ 10 */
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 void setRange(int start, int length, List<E> from, [int startFrom]) { 118 void setRange(int start, int length, List<E> from, [int startFrom]) {
119 _list.setRange(start, length, from, startFrom); 119 _list.setRange(start, length, from, startFrom);
120 } 120 }
121 121
122 void removeRange(int start, int length) { _list.removeRange(start, length); } 122 void removeRange(int start, int length) { _list.removeRange(start, length); }
123 123
124 void insertRange(int start, int length, [E fill]) { 124 void insertRange(int start, int length, [E fill]) {
125 _list.insertRange(start, length, fill); 125 _list.insertRange(start, length, fill);
126 } 126 }
127
128 Map<int, E> asMap() => IterableMixinWorkaround.asMapList(_list);
127 } 129 }
128 130
129 /** 131 /**
130 * Iterator wrapper for _WrappedList. 132 * Iterator wrapper for _WrappedList.
131 */ 133 */
132 class _WrappedIterator<E> implements Iterator<E> { 134 class _WrappedIterator<E> implements Iterator<E> {
133 Iterator _iterator; 135 Iterator _iterator;
134 136
135 _WrappedIterator(this._iterator); 137 _WrappedIterator(this._iterator);
136 138
137 bool moveNext() { 139 bool moveNext() {
138 return _iterator.moveNext(); 140 return _iterator.moveNext();
139 } 141 }
140 142
141 E get current => _iterator.current; 143 E get current => _iterator.current;
142 } 144 }
OLDNEW
« no previous file with comments | « tests/corelib/list_as_map_test.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698