use list instead of arraylist