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

HashMap should be clever enough to do a rehash in case of a collision.

Since your problem is one of permutations, using an array and something like this will let you generate the arrangement as you need it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.