Write a method that removes duplicate elements from an ArrayList while preserving the first occurrence order.
Method signature:Â public static ArrayList<Integer> removeDuplicates(ArrayList<Integer> list)
Example:
Merge two sorted ArrayLists into one sorted ArrayList.
Method signature:Â public static ArrayList<Integer> mergeSorted(ArrayList<Integer> list1, ArrayList<Integer> list2)
Example:
Write a method that partitions an ArrayList into two lists based on a predicate (even/odd numbers).
Method signature:Â public static ArrayList<ArrayList<Integer>> partition(ArrayList<Integer> list)
Example: