Programming, beginner
I have a question to ask you later
Programming, beginner
It is a very useful quality that, for a mapping from keys to values, that you can also lookup the key from the value. How do you prefer to implement this?
Do you (1) create another data structure that maps from the values to the keys? or (2) have the data structure that maps from key to values also support the other way around? or (3) make the value responsible for that, always storing the key inside the value?
Programming, beginner
@ro Coordinate-pair to object reference.
Weird usage pattern, I first get coordinate-pair from existing object reference, then lookup all neighbouring coordinates. Sort of like launch upwards and strike from above.
At least 1000 keys, which is why I assume can't iterate frequently
Programming, beginner
@ro By "I first get coordinate-pair from existing object reference", I meant I try to look up from the hypothetical thingy, the coordinate-pair for the object reference. The object doesn't store its own coordinates right now, that's one way I could solve it but question was which type of solution you prefer
Java can do it because Object has #hashCode, so all objects are hashable