I have two kinds of objects identified by a long and these objects should be mapped to column or row indices in a matrix of type int. There are thousands of objects to be mapped and only the combination of the IDs is unique (e.g. (1,1) -> 0; (1,2) -> 1; … (2,2)->…)).
Is a Map<String, Integer> where the key is "long1<a separator>long2" the way to go or are there better solutions?
Thanks
You can create a hash from a long with
for two longs you can combine there
Its not guaranteed to be unique, but it doesn’t use any memory.