Allows an iterator to be passed to populate the array.