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); |