Skip to content

Commit

Permalink
Added a function to convert the list sequence to an array
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl Lundfall committed Apr 21, 2017
1 parent 9ec0afe commit e700dd0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/LinkedListViewSequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ define(function(require, exports, module) {
return -1;
};

LinkedListViewSequence.prototype.toArray = function() {
var sequence = this._.head;
var index = 0;
var arrayConversion = new Array(this.getLength());
while (sequence) {
arrayConversion[index] = sequence._value;
index++;
sequence = sequence._next;
}
return arrayConversion;
};

/**
* Finds the view-sequence item at the given index.
*
Expand Down

0 comments on commit e700dd0

Please sign in to comment.