Generate numeric or string ID for a sequence of elements
If you don't care about the length of the id, sort the list and use that as the id.

If you do care about its length, sort the list and then use the SHA256 hash of the sorted list as the id.  It is believed to be infeasible to find collisions for SHA256, so you shouldn't have to worry about collisions.  If you find one, publish it and you'll be famous (briefly).