Reimplement .toArray using .collect
Merge pull request #151 from LewisJEllis/toArray-collect

Reimplement .toArray using .collect