Provide the missing piece (underlined) to complete this method definition.
ArrayList noCopies(ArrayList list) { ArrayList newList = new ArrayList(); for (int value : list) if (! newList.contains(value)) ___________________ return newList; }
This method takes an ArrayList as an argument and returns a new ArrayList with all of the values in the argument ArrayList, but without any duplicates.
For example:
given an ArrayList named myList that contains this list of values: {5, 3, 1, 2, 1, 3, 3},
noCopies(myList) will return an ArrayList that contains this list of values: {5, 3, 1, 2}
given an ArrayList named myList that contains this list of values: {1, 1, 5, 5, 3, 3},
noCopies(myList) will return an ArrayList that contains this list of values: {1, 5, 3}