Can someone suggest an elegant way to solve the following problem please?
I have a multi-map keyed by time, and i wish to return the item that occured closest to a specified time T. In addition, the times searched within the map can only be an hour either side of T.
Tried multiple techniques, however the most efficient would seem to be to firstly reject all times that are not within an hour of T, and then iterate over the remaining items to find the one closest to T.