My problem is as follows. I have an arraylist of integers. Arraialist contains 5 chains, for example [5,5,3,3,9] or, possibly, [2,2,2,2,7]. Many of the arraylists have duplicate values, and I'm not sure how to calculate how many of each of the values exist.
The problem is how to find duplicate values in the arraylist and calculate how much exactly this duplicate is. In the first example [5,5,3,3,9] there are 2 5 and 2 3. The second example [2,2,2,2,7] will be only 4 2. The information I want to find is if there are some duplicates, how many of them are and which specific whole has been duplicated.
I'm not too sure how to do this in java.
Any help would be greatly appreciated. Thank.
Julio source
share