I have an integer arraylist that has consecutive duplicate lines. I want to output each number that is not the same as the one before.
Sample: 1 3 3 3 2 2 1 2 2 3 3 3
Desired output: 1 3 2 1 2 3
How should I do this?
I am essentially creating an inverted index of words to any input of text files. I have a file/buffered reader reading from multiple text files line by line and placing each line into a 2d array with the first column being a .split word and the second column being the filename from which the word was obtained. I then have a for loop to get the frequency a particular word occurs in all of the files and add it to another column. I then copied each column into their own arraylist. I added the words arraylist to a hashset to remove the duplicates. but I want to remove only consecutive duplicates of the frequency arraylist.