Given the following data structure:
[{
start: 10.2,
end: 15.3,
text: 'Lorem Ipsum....'
}, {
start: 16.3,
end: 20.5,
text: 'dolor sit...'
}, {
start: 19.4,
end: 25.1,
text: 'consectetur adipiscing elit'
}]
I need to figure out the active text for a given time (e.g. 18
, which maches element 2 and 3). I already implemented a find method that checks if the given time is greater than start and lesser than end. Unfortunately that's not as efficient for around 25k entries. I'm therefore looking for a hashmap implementation that has calculates start and end as keys and returns for a given time the matching entries.