Reading material

Pages 114-118.

Additional material

RankedSequence.java

Using interfaces

public static RankedSequence removeDuplicates(RankedSequence sequence) {
    for (int i = 0; i < sequence.size(); i++) {
        int j = i + 1
        while (j < sequence.size()) {
            Object first = sequence.ElemAtRank(i);
            Object second = sequence.ElemAtRank(j);
            if (first.equals(second)) {
                sequence.removeElemAtRank(j);
            } else {
                j++;
            }
        }
    }
    return sequence;
}