+ 2
How are duplicates removed from a given array in Java?
2 Answers
+ 12
We can remove duplicate element in an arrayby 2 ways: using temporary array or using separate index. To remove the duplicateelement from array, the array must be in sorted order. If array is not sorted, you can sort it by calling Arrays.sort(arr) method.
Source: https://www.javatpoint.com/java-program-to-remove-duplicate-element-in-an-array
+ 1
use hashSet
just assign your array to a hashSet.duplicates removed automatically.