I want to remove frequent patterns from an arraylist. I tried this using hashset but output appears the same.This is the sample set of my arraylist which is residing on a file mytext.txt...How to remove the repeated sequences either before adding into file or after adding into file?
This is the content of my newlist......when i print the contents of newList the following output gets printed without repeated entries...But after writing to a file it shows repeated sequences
HashSet<String> hash1 = new HashSet<String>();
hash1.addAll(newList2);
newList2.clear();
newList2.addAll(hash1);
System.out.println(hash1);
output
[arrested, snatching, chain, for, A, escaped, on, from, Friday, man]
[arrested, snatching, chain, for, A, escaped, on, from, Friday, man]
[arrested, snatching, chain, for, A, escaped, on, from, Friday, man]