I have 2 list of numbers and i only want the unique number to be the output which means the number that only appear once in the list. And it has to be double not integers.
Example:
list 1: {1.1, 8.0, 4.0, 1.1}
list 2: {1.1, 8.0, 4.0}
"8.0" and "4.0" are unique in both list 1 and list 2.
I need a way to identify numbers like 8.0 and 4.0 where it matches and occurs only once in each list.
I tried using this code but the output is not what i want.
Double[] i = {100.00, 100.00, 17246.40, 2568.00, 0.20, 9845.00, 5768.18, 0.20, 30.00, 63.68, 83.56, 444.39, 144.20,
2889.00};
Set<Double> uniqKeys = new TreeSet<Double>();
uniqKeys.addAll(Arrays.asList(i));
System.out.println("List 1: " + uniqKeys);
This is the output for the above code
List 1: [0.2, 30.0, 63.68, 83.56, 100.0, 144.2, 444.39, 2568.0, 2889.0, 5768.18, 9845.0, 17246.4]
But what i want the output to be is
17246.4, 2568.0, 9845.0, 5768.18, 30.0, 63.68, 83.56, 444.39, 144.20, 2889.0
Thanks.