Refactor -toArray using -collect and -first

And because collectedValues is mutable, return immutable object using -copy.