I have the numbers 0-8 so I can represent a state as

012345678

012345687

....

876543201

876543210

This gives me 40320 ways to represent a state so I have a HashMap of size 40320 and I need a good way to make sure each state only corresponds to 1 key 1-40320

I'm not really sure how to even come close to making sure there are no possible collisions. Any help would be greatly appreciated