Help removing int duplicates from an array
in
Programming Questions
•
6 months ago
Hi,
I am trying to use HashSet to remove duplicate integers from an array of integers
- int[] numbers = {1,2,3,4,5,5,3,2,1};
- HashSet<int[]> mySet = new HashSet<int[]>(Arrays.asList(numbers));
Since I am sort of new to java programming and processing I am not really sure if I'm doing this right. I read somewhere that converting to a hash set will automatically remove duplicate entries, but I can't very that or whether that works with integers or if I have to convert to a string.
Any help would be appreciated.
1