> TL;DR: If you don’t need to preserve order of the elements, sort the slice first and dedupe.
And if you need to preserve order of elements, there is always sort.Stable!
And if you need to preserve order of elements, there is always sort.Stable!
For a list of plain uin64 sort and stable sort would produce the same output.
Even if you attached some other information to distinguish them, for the purpose of deduplicating you want the values with the same key to be in sequence. Stable sort could help you to choose whether you keep the first or last of the duplicate, but the initial order of unique elements would be lost just like with regular sort.
Edit: I see now that the original article meant preserving output order. And i have not clarified that i meant input order.