I'm pretty new to programming in Java and I want to make a program that will print out some values from a file. I want to import a array list from a file which contains a large set of repeated numbers. The program should print out only one unique number of set.
For example, the array contains these numbers:
0,0,0,0,2,2,2,2,2,3,3,3,3,3,5,5,5,5,8,8,10,10,2,2,2,3,3,7,7
and what I should get out of it is this:
0,2,3,5,8,10,2,3,7
The same would be needed if the array wasn't containing integers, but floating point numbers:
0.23, 0.23, 0.23, 0.23, 1.89, 1.89, 1.89, 1.89, 1.89, 2.56, 2.56, 2.56, 2.56, 2.56, 3.13, 3.13
The output should be:
0.23, 1.89, 2.56, 3.13
Has anyone some suggestions on how should I build the loop?
Thanks in advance