For a given list, say `[ "a", "a", "b", "c", "c" ]` I need `[ "b" ]` (*only non duplicated elements*) as output. Note that this is different from using the `Set` interface for the job...

I wrote the following code to do this in Java:

```
void unique(List<String> list) {
    Collections.sort(list);
    List<String> dup = new ArrayList<>();
    int i = 0, j = 0;

    for (String e : list) {
        i = list.indexOf(e);
        j = list.lastIndexOf(e);

        if (i != j && !dup.contains(e)) {
            dup.add(e);
        }
    }

    list.removeAll(dup);
}

```

It works... but for a list of size 85320, ends after several minutes!