I have objects with the following properties:
class MyObject
{
int sourceId();
String id();
}
If I use id
as the identifier, there could be collisions as there may be records with the same id
but different sourceId
Therefore I'm looking into generating a hash of sourceId
and id
and using that to generate unique ids for each record. I was thinking of just md5ing String.valueOf(sourceId + id)
, but it seems that md5 collisions are not as uncommon as I'd like.
Which other algorithm would be recommended for this, something which produces a fast hash, and where it'd also be very improbable for a collision to occur?