add the arraylist and test method to q4