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

Unified Diff: runtime/lib/byte_array.dart

Issue 10386039: Add indexOf to Int/Float-List's. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed var. Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/byte_array_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/byte_array.dart
diff --git a/runtime/lib/byte_array.dart b/runtime/lib/byte_array.dart
index a08cfbaf799bb9709edfdff19b5a258576e45314..320c0c30beef81241b77eb5ba6d54cd2b9bc17d1 100644
--- a/runtime/lib/byte_array.dart
+++ b/runtime/lib/byte_array.dart
@@ -260,6 +260,13 @@ abstract class _ByteArrayBase {
"Cannot remove from a non-extendable array");
}
+ int indexOf(element, [int start = 0]) {
+ for (int i = start; i < length; i++) {
+ if (this[i] == element) return i;
+ }
+ return -1;
+ }
+
void insertRange(int start, int length, [initialValue]) {
throw const UnsupportedOperationException(
"Cannot add to a non-extendable array");
« no previous file with comments | « no previous file | tests/standalone/byte_array_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698