Write ListToolsApp with five static methods on ArrayList<Integer>:
readList(Scanner in)— reads a count, then that many numbers;max(list)— the largest element, ornullwhen the list is empty;sum(list);union(a, b)— a new list: the elements ofafollowed by those ofb;removeDuplicates(list)— keeps the first occurrence of each value, changing the list itself.
Write the loops yourself (no Collections.max). main reads two lists. For the input
5
3 5 45 5 11
3
33 22 5
the program prints
First: [3, 5, 45, 5, 11], maximum 45, sum 69
Second: [33, 22, 5], maximum 33, sum 60
Both together: [3, 5, 45, 5, 11, 33, 22, 5]
Without duplicates: [3, 5, 45, 11, 33, 22]
First is unchanged: [3, 5, 45, 5, 11]