reuse List#toArray instead of copying values using for loop