Permalink
Browse files

Add toArray impl.

  • Loading branch information...
1 parent 4c8890b commit 93efcf97451c0184b870a9ffcac288d55ad32cac @bjornharrtell bjornharrtell committed Aug 11, 2011
Showing with 29 additions and 7 deletions.
  1. +6 −6 lib/javascript.util.js
  2. +14 −0 src/ArrayList.js
  3. +8 −0 src/Collection.js
  4. +1 −1 src/javascript.util.js
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -80,6 +80,20 @@ javascript.util.ArrayList.prototype.size = function() {
return this.array.length;
};
+/**
+ * @override
+ * @export
+ */
+javascript.util.ArrayList.prototype.toArray = function() {
+ var array = [];
+
+ for (var i=0; i<this.array.length; i++) {
+ array.push(this.array[i]);
+ };
+
+ return array;
+};
+
/**
* @implements {javascript.util.Iterator}
* @param {javascript.util.ArrayList}
View
@@ -44,3 +44,11 @@ javascript.util.Collection.prototype.iterator = function() {};
* @export
*/
javascript.util.Collection.prototype.size = function() {};
+
+/**
+ * Returns an array containing all of the elements in this collection.
+ *
+ * @return {Array}
+ * @export
+ */
+javascript.util.Collection.prototype.toArray = function() {};
View
@@ -98,7 +98,7 @@ javascript.util = {};
/**
* @export
*/
-javascript.util.version = '0.3.1';
+javascript.util.version = '0.4.0';
/**
* @param {string=}

0 comments on commit 93efcf9

Please sign in to comment.