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

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

Issue 2750163004: Add type parameters to methods in typed-data patch. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | 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) 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 import "dart:_internal" hide Symbol; 5 import "dart:_internal" hide Symbol;
6 import "dart:collection" show ListBase; 6 import "dart:collection" show ListBase;
7 import 'dart:math' show Random; 7 import 'dart:math' show Random;
8 8
9 @patch 9 @patch
10 class ByteData implements TypedData { 10 class ByteData implements TypedData {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 var len = this.length; 52 var len = this.length;
53 if (len == 0) throw IterableElementError.noElement(); 53 if (len == 0) throw IterableElementError.noElement();
54 var i = 0; 54 var i = 0;
55 var value = this[0]; 55 var value = this[0];
56 for (var i = 1; i < len; ++i) { 56 for (var i = 1; i < len; ++i) {
57 value = combine(value, this[i]); 57 value = combine(value, this[i]);
58 } 58 }
59 return value; 59 return value;
60 } 60 }
61 61
62 dynamic fold( 62 T fold<T>(T initialValue, T combine(T initialValue, element)) {
63 dynamic initialValue, dynamic combine(dynamic initialValue, element)) {
64 var len = this.length; 63 var len = this.length;
65 for (var i = 0; i < len; ++i) { 64 for (var i = 0; i < len; ++i) {
66 initialValue = combine(initialValue, this[i]); 65 initialValue = combine(initialValue, this[i]);
67 } 66 }
68 return initialValue; 67 return initialValue;
69 } 68 }
70 69
71 Iterable map(f(element)) => new MappedIterable(this, f); 70 Iterable<T> map<T>(T f(element)) => new MappedIterable<dynamic, T>(this, f);
72 71
73 Iterable expand(Iterable f(element)) => new ExpandIterable(this, f); 72 Iterable<T> expand<T>(Iterable<T> f(element)) =>
73 new ExpandIterable<dynamic, T>(this, f);
74 74
75 bool every(bool f(element)) { 75 bool every(bool f(element)) {
76 var len = this.length; 76 var len = this.length;
77 for (var i = 0; i < len; ++i) { 77 for (var i = 0; i < len; ++i) {
78 if (!f(this[i])) return false; 78 if (!f(this[i])) return false;
79 } 79 }
80 return true; 80 return true;
81 } 81 }
82 82
83 bool any(bool f(element)) { 83 bool any(bool f(element)) {
(...skipping 2992 matching lines...) Expand 10 before | Expand all | Expand 10 after
3076 'BYTES_PER_ELEMENT ($alignment)'); 3076 'BYTES_PER_ELEMENT ($alignment)');
3077 } 3077 }
3078 } 3078 }
3079 3079
3080 int _defaultIfNull(object, value) { 3080 int _defaultIfNull(object, value) {
3081 if (object == null) { 3081 if (object == null) {
3082 return value; 3082 return value;
3083 } 3083 }
3084 return object; 3084 return object;
3085 } 3085 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698