write (define) a public static method named noDuplicates, that takes an ArrayList as an argument and returns a new ArrayList with all of the values in the argument ArrayList, but without any duplicates given an ArrayList named myList that contains this list of values: {5, 3, 1, 2, 1, 3, 3}, noDuplicates(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}, noDuplicates(myList) will return an ArrayList that contains this list of values: {1, 5, 3} ----------------------------------------------- import java.util.ArrayList; public class Main { public static void main(String[] args) { // you may wish to write some code in this main method // to test your method. } }
write (define) a public static method named noDuplicates, that takes an ArrayList<Integer> as an argument and returns a new ArrayList<Integer> with all of the values in the argument ArrayList, but without any duplicates
given an ArrayList<Integer> named myList that contains this list of values: {5, 3, 1, 2, 1, 3, 3},
noDuplicates(myList) will return an ArrayList<Integer> that contains this list of values: {5, 3, 1, 2}
given an ArrayList<Integer> named myList that contains this list of values: {1, 1, 5, 5, 3, 3},
noDuplicates(myList) will return an ArrayList<Integer> that contains this list of values: {1, 5, 3}
-----------------------------------------------
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
// you may wish to write some code in this main method
// to test your method.
}
<your method definition(s) here>
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images