I am trying to create a list, which only consists of unique values.
String[] arr = {"5", "5", "7", "6", "7", "8", "0"};
List<String> uniqueList = new ArrayList<String>(new HashSet<String>( Arrays.asList(arr) ));
System.out.println( uniqueList );
What I expect as an output is: 6,8,0. So, if duplicates exist, I want to delete both of them. The HashSet only removes the duplicates, so that each value only occurs once. However, I want to remove both the numbers, so that I end up with a list, which only has the numbers that occur once in the original list.