Hey, I need to read a textfile in java. The problem is that the file has the following format:
Id time1 time2 time3 ...
ID2 time1 time2 time3 ...
One solution is to parse the file once and create an index of the positions of each ids in the file. Then, you can reposition the reading 'cursor' as needed to ids.
EDIT
This solution is practical if the whole file content cannot be loaded into memory. To limit the number of physical readings, a LRU cache keeping the most recently read or used id-times combinations could improve performance.