1. ArrayList Exercises

Exercise 1: Remove Duplicates

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:

Exercise 2: Merge Two Sorted Lists

Merge two sorted ArrayLists into one sorted ArrayList.

Method signature: public static ArrayList<Integer> mergeSorted(ArrayList<Integer> list1, ArrayList<Integer> list2)

Example:

Exercise 3: ArrayList Partition

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:

2. HashMap Exercises