Creata unsorted position list

This commit is contained in:
2014-04-06 20:38:04 +02:00
parent c193420828
commit 7f3a0bfc24
4 changed files with 145 additions and 54 deletions

View File

@@ -1,7 +1,12 @@
package com.xgiovio;
import position.Position;
import position.PositionList;
import sequence.Sequence;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Created with MONSTER.
* User: xgiovio
@@ -19,4 +24,35 @@ class global {
}
public static void cancellaDuplicati (PositionList<Integer>L){
if (L.size() >=2){
Position<Integer> first;
Position<Integer> second;
first = L.first();
second = L.next(first);
for (;true;) {
if (first.element().equals(second.element())) {
L.remove(second);
if (first!= L.last()) {
second = L.next(first);
}else {
break;
}
} else {
first = second;
if (first!= L.last()) {
second = L.next(second);
}else {
break;
}
}
}
}
}
}