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

Unified Diff: frog/minfrog

Issue 9114021: Added method map to Collection interface and all its implementations (except classes generated fr... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | « frog/lib/corelib_impl.dart ('k') | frog/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/minfrog
===================================================================
--- frog/minfrog (revision 3161)
+++ frog/minfrog (working copy)
@@ -265,6 +265,8 @@
}, enumerable: false, configurable: true });
Object.defineProperty(Object.prototype, "last$0", { value: function() {
return this.noSuchMethod("last", []);
+Object.defineProperty(Object.prototype, "map$1", { value: function($0) {
+ return this.noSuchMethod("map", [$0]);
}, enumerable: false, configurable: true });
Object.defineProperty(Object.prototype, "markUsed$0", { value: function() {
return this.noSuchMethod("markUsed", []);
@@ -623,6 +625,9 @@
Object.defineProperty(ListFactory.prototype, "isEmpty$0", { value: ListFactory.prototype.isEmpty, enumerable: false, configurable: true });
Object.defineProperty(ListFactory.prototype, "iterator$0", { value: ListFactory.prototype.iterator, enumerable: false, configurable: true });
Object.defineProperty(ListFactory.prototype, "last$0", { value: ListFactory.prototype.last, enumerable: false, configurable: true });
+Object.defineProperty(ListFactory.prototype, "map$1", { value: function($0) {
+ return this.map(to$call$1($0));
+}, enumerable: false, configurable: true });
Object.defineProperty(ListFactory.prototype, "removeLast$0", { value: ListFactory.prototype.removeLast, enumerable: false, configurable: true });
Object.defineProperty(ListFactory.prototype, "some$1", { value: function($0) {
return this.some(to$call$1($0));
@@ -1118,6 +1123,14 @@
}
);
}
+HashSetImplementation.prototype.map = function(f) {
+ var result = new HashSetImplementation();
+ this._backingMap.forEach(function _(key, value) {
+ result.add(f(key));
+ }
+ );
+ return result;
+}
HashSetImplementation.prototype.filter = function(f) {
var result = new HashSetImplementation();
this._backingMap.forEach(function _(key, value) {
@@ -1157,6 +1170,9 @@
};
HashSetImplementation.prototype.isEmpty$0 = HashSetImplementation.prototype.isEmpty;
HashSetImplementation.prototype.iterator$0 = HashSetImplementation.prototype.iterator;
+HashSetImplementation.prototype.map$1 = function($0) {
+ return this.map(to$call$1($0));
+};
HashSetImplementation.prototype.some$1 = function($0) {
return this.some(to$call$1($0));
};
@@ -1484,6 +1500,16 @@
}
return false;
}
+DoubleLinkedQueue.prototype.map = function(f) {
+ var other = new DoubleLinkedQueue();
+ var entry = this._sentinel._next;
+ while (entry !== this._sentinel) {
+ var nextEntry = entry._next;
+ other.addLast(f(entry._element));
+ entry = nextEntry;
+ }
+ return other;
+}
DoubleLinkedQueue.prototype.filter = function(f) {
var other = new DoubleLinkedQueue();
var entry = this._sentinel._next;
@@ -1511,6 +1537,9 @@
DoubleLinkedQueue.prototype.isEmpty$0 = DoubleLinkedQueue.prototype.isEmpty;
DoubleLinkedQueue.prototype.iterator$0 = DoubleLinkedQueue.prototype.iterator;
DoubleLinkedQueue.prototype.last$0 = DoubleLinkedQueue.prototype.last;
+DoubleLinkedQueue.prototype.map$1 = function($0) {
+ return this.map(to$call$1($0));
+};
DoubleLinkedQueue.prototype.removeLast$0 = DoubleLinkedQueue.prototype.removeLast;
DoubleLinkedQueue.prototype.some$1 = function($0) {
return this.some(to$call$1($0));
@@ -1769,6 +1798,13 @@
}
return destination;
}
+Collections.map = function(source, destination, f) {
+ for (var $$i = source.iterator(); $$i.hasNext$0(); ) {
+ var e = $$i.next$0();
+ destination.add(f(e));
+ }
+ return destination;
+}
// ********** Code for _Worker **************
// ********** Code for _ArgumentMismatchException **************
$inherits(_ArgumentMismatchException, ClosureArgumentMismatchException);
« no previous file with comments | « frog/lib/corelib_impl.dart ('k') | frog/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698