Add arraylist foreach function