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

Side by Side Diff: lib/html/src/_Lists.dart

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
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 _Lists { 5 class _Lists {
6
7 /** 6 /**
8 * Returns the index in the array [a] of the given [element], starting 7 * Returns the index in the array [a] of the given [element], starting
9 * the search at index [startIndex] to [endIndex] (exclusive). 8 * the search at index [startIndex] to [endIndex] (exclusive).
10 * Returns -1 if [element] is not found. 9 * Returns -1 if [element] is not found.
11 */ 10 */
12 static int indexOf(List a, 11 static int indexOf(List a,
13 Object element, 12 Object element,
14 int startIndex, 13 int startIndex,
15 int endIndex) { 14 int endIndex) {
16 if (startIndex >= a.length) { 15 if (startIndex >= a.length) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 if (length < 0) throw new ArgumentError('length'); 58 if (length < 0) throw new ArgumentError('length');
60 if (start < 0) throw new IndexOutOfRangeException(start); 59 if (start < 0) throw new IndexOutOfRangeException(start);
61 int end = start + length; 60 int end = start + length;
62 if (end > a.length) throw new IndexOutOfRangeException(end); 61 if (end > a.length) throw new IndexOutOfRangeException(end);
63 for (int i = start; i < end; i++) { 62 for (int i = start; i < end; i++) {
64 accumulator.add(a[i]); 63 accumulator.add(a[i]);
65 } 64 }
66 return accumulator; 65 return accumulator;
67 } 66 }
68 } 67 }
OLDNEW
« no previous file with comments | « lib/html/src/_Collections.dart ('k') | lib/html/templates/html/dart2js/impl_Console.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698