If have list of af string, how can filter so equal neighbors only appears one?
Example:
['0.1', '0.1', '0.2','0.3','0.3','0.1','0.2']
should result in
['0.1', '0.2','0.3','0.1','0.2']
notice that element 0, 1 only appears once and element 4 and 5 also appears only once.
If use unique:
['0.1', '0.1', '0.2','0.3','0.3','0.1','0.2'].unique()
the result will be:
['0.1', '0.2','0.3'] //what is not wanted
Any suggestions for the best groovy method?