nimo frey wrote:Oh, actually I have no collisions - all my instances are identifiable via the string version of the hashCode.
So what should I use instead? Should I override the toString-Version for identification?
nimo frey wrote:
I guess, I cannot use the
UUID a = UUID.randomUUID();
When I generate a UUID for the instance x and the client sends that UUID back to me, the instance x is no more binded to that UUID.
So I cannot compare it with the servers UUID as generating a new one for the instance x results in another UUID.
Maybe, this is the right thing to do:
UUID b = UUID.fromString(this.toString());
It is if you make that a field of the object.
I like JV’s suggestion of an automatically incremented field.