Fix performance issue where apply function can be called millions of times and consume CPU by calculating the transformed list only one time (copying into a new array list.)