Added a toArray() method to the collection and a test