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

Side by Side Diff: runtime/lib/byte_array.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
« no previous file with comments | « runtime/lib/array.dart ('k') | runtime/lib/growable_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 // 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 patch class Int8List { 5 patch class Int8List {
6 /* patch */ factory Int8List(int length) { 6 /* patch */ factory Int8List(int length) {
7 return new _Int8Array(length); 7 return new _Int8Array(length);
8 } 8 }
9 9
10 /* patch */ factory Int8List.view(ByteArray array, 10 /* patch */ factory Int8List.view(ByteArray array,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 abstract class _ByteArrayBase { 117 abstract class _ByteArrayBase {
118 abstract int lengthInBytes(); 118 abstract int lengthInBytes();
119 119
120 abstract int bytesPerElement(); 120 abstract int bytesPerElement();
121 121
122 abstract operator[](int index); 122 abstract operator[](int index);
123 123
124 // Methods implementing the Collection interface. 124 // Methods implementing the Collection interface.
125 125
126 bool contains(element) => Collections.contains(this, element);
127
126 void forEach(void f(element)) { 128 void forEach(void f(element)) {
127 var len = this.length; 129 var len = this.length;
128 for (var i = 0; i < len; i++) { 130 for (var i = 0; i < len; i++) {
129 f(this[i]); 131 f(this[i]);
130 } 132 }
131 } 133 }
132 134
133 Collection map(f(element)) { 135 Collection map(f(element)) {
134 return Collections.map(this, new List(), f); 136 return Collections.map(this, new List(), f);
135 } 137 }
(...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after
2409 } 2411 }
2410 _rangeCheck(this.length, start, length); 2412 _rangeCheck(this.length, start, length);
2411 return _array.subByteArray(_offset + start, length); 2413 return _array.subByteArray(_offset + start, length);
2412 } 2414 }
2413 2415
2414 static const int _BYTES_PER_ELEMENT = 8; 2416 static const int _BYTES_PER_ELEMENT = 8;
2415 final ByteArray _array; 2417 final ByteArray _array;
2416 final int _offset; 2418 final int _offset;
2417 final int _length; 2419 final int _length;
2418 } 2420 }
OLDNEW
« no previous file with comments | « runtime/lib/array.dart ('k') | runtime/lib/growable_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698