Challenge 2: Remove Duplicates From an ArrayList

In this challenge, you'll have to code for removing the duplicates from an ArrayList.

Problem statement #

Given a Character ArrayList, you have to implement a Java method to remove all the duplicate elements from it.

Function prototype #

void removeDuplicates(ArrayList<Character> arrList)

Output #

An ArrayList with all the unique elements.

Sample input #

arrList = [a,b,b,c,c,c,d]

Sample output #

arrList = [a,b,c,d]

Get hands-on with 1200+ tech skills courses.