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

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

Issue 14246008: Allow Object when doing lookups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix type error. Created 7 years, 6 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 static final int _classId = (new _ObjectArray(0))._cid; 8 static final int _classId = (new _ObjectArray(0))._cid;
9 9
10 factory _ObjectArray(length) native "ObjectArray_allocate"; 10 factory _ObjectArray(length) native "ObjectArray_allocate";
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 int length = end - start; 111 int length = end - start;
112 if (start == end) return []; 112 if (start == end) return [];
113 List list = new _GrowableObjectArray<E>.withCapacity(length); 113 List list = new _GrowableObjectArray<E>.withCapacity(length);
114 list.length = length; 114 list.length = length;
115 Arrays.copy(this, start, list, 0, length); 115 Arrays.copy(this, start, list, 0, length);
116 return list; 116 return list;
117 } 117 }
118 118
119 // Iterable interface. 119 // Iterable interface.
120 120
121 bool contains(E element) { 121 bool contains(Object element) {
122 return IterableMixinWorkaround.contains(this, element); 122 return IterableMixinWorkaround.contains(this, element);
123 } 123 }
124 124
125 void forEach(f(E element)) { 125 void forEach(f(E element)) {
126 IterableMixinWorkaround.forEach(this, f); 126 IterableMixinWorkaround.forEach(this, f);
127 } 127 }
128 128
129 String join([String separator = ""]) { 129 String join([String separator = ""]) {
130 return IterableMixinWorkaround.joinList(this, separator); 130 return IterableMixinWorkaround.joinList(this, separator);
131 } 131 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 Arrays.copy(this, start, list, 0, length); 364 Arrays.copy(this, start, list, 0, length);
365 return list; 365 return list;
366 } 366 }
367 367
368 Iterable<E> getRange(int start, int end) { 368 Iterable<E> getRange(int start, int end) {
369 return IterableMixinWorkaround.getRangeList(this, start, end); 369 return IterableMixinWorkaround.getRangeList(this, start, end);
370 } 370 }
371 371
372 // Collection interface. 372 // Collection interface.
373 373
374 bool contains(E element) { 374 bool contains(Object element) {
375 return IterableMixinWorkaround.contains(this, element); 375 return IterableMixinWorkaround.contains(this, element);
376 } 376 }
377 377
378 void forEach(f(E element)) { 378 void forEach(f(E element)) {
379 IterableMixinWorkaround.forEach(this, f); 379 IterableMixinWorkaround.forEach(this, f);
380 } 380 }
381 381
382 Iterable map(f(E element)) { 382 Iterable map(f(E element)) {
383 return IterableMixinWorkaround.mapList(this, f); 383 return IterableMixinWorkaround.mapList(this, f);
384 } 384 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 } 549 }
550 _position = _length; 550 _position = _length;
551 _current = null; 551 _current = null;
552 return false; 552 return false;
553 } 553 }
554 554
555 E get current { 555 E get current {
556 return _current; 556 return _current;
557 } 557 }
558 } 558 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698