I would not use a map, instead I will try with R-Tree . An R-tree is a tree structure designed to index spatial data. It stores rectangles. It is often used to check if a point (coordinate) is inside another geometry. These geometries are approximated by rectangles, and they are stored in a tree.
To save the rectangle (or information about it), you only need to save the coordinates of the lower left and upper right corners. In your case, this will be the lower and upper boundary of the time interval. You can think of it as if all y values ββwere 0. Then you can query a tree with your time value.
And of course, you save the value on each sheet (time span / rectangle)
A simple google search for r-tree java
yielded some outstanding results. Implementing your own R-tree is not trivial, but it is not too difficult if you understand the principle of reinstalling the tree when inserting / deleting. In your one-dimensional case, this can become even simpler.
source share