Optimize ArrayList construction