finished stack to array list transformation