I'm not sure how to search for or properly phrase this, so if there's duplicates, please forgive me.
What I'm thinking is:
Using a sorted integer-key map, I would like to access it with a key that isn't currently used:
someMap = {1 -> "one", 4 -> "four", 5 -> "five"}
someMap.get(2) == "one"
(Edit: for clarity, I'm only concerned about interacting with the keys themselves. The actual data the keys are pointing to is irrelevant to this question.)
Coming from java, I'd expect to implement some sort of Comparator to explicitly define how to choose the closest (or from other criteria) element -- but I'd be curious to hear about other ways of doing this (bit shifts?).