arraylist to list & create function