Commit 3c824731 authored by Marko Luukkainen's avatar Marko Luukkainen Committed by Tuukka Lehtonen

Fix CollectionUtils.unique (removed unique items)

gitlab #679

Change-Id: I4c297a9a3ed258e16b2cd3663b63115748c6ae61


(cherry picked from commit ac7b954f)
parent 636b2fc6
......@@ -217,15 +217,13 @@ public final class CollectionUtils {
* Remove elements that appear more than once. Keep order otherwise.
* @param list to be pruned
*/
public static void unique(List<?> list) {
int c = list.size();
int i = c-1;
public static void unique(List<?> list) {
int i = list.size()-1;
while (i>0) {
Object o = list.get(i);
int index = list.indexOf(o);
if (index>=0) {
if (index>=0 && index < i) {
list.remove(index);
c--;
i--;
} else {
i--;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment