Index: frog/minfrog |
=================================================================== |
--- frog/minfrog (revision 2973) |
+++ frog/minfrog (working copy) |
@@ -247,6 +247,9 @@ |
Object.prototype.last$0 = function() { |
return this.noSuchMethod("last", []); |
}; |
+Object.prototype.map$1 = function($0) { |
+ return this.noSuchMethod("map", [$0]); |
+}; |
Object.prototype.markUsed$0 = function() { |
return this.noSuchMethod("markUsed", []); |
}; |
@@ -600,6 +603,9 @@ |
ListFactory.prototype.isEmpty$0 = ListFactory.prototype.isEmpty; |
ListFactory.prototype.iterator$0 = ListFactory.prototype.iterator; |
ListFactory.prototype.last$0 = ListFactory.prototype.last; |
+ListFactory.prototype.map$1 = function($0) { |
+ return this.map(to$call$1($0)); |
+}; |
ListFactory.prototype.removeLast$0 = ListFactory.prototype.removeLast; |
ListFactory.prototype.some$1 = function($0) { |
return this.some(to$call$1($0)); |
@@ -1101,6 +1107,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) { |
@@ -1140,6 +1154,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)); |
}; |
@@ -1472,6 +1489,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; |
@@ -1499,6 +1526,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)); |
@@ -1757,6 +1787,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); |