문제

I'll start with my question:

From a performance perspective, is it more efficient to search a .txt file line by line using BufferedReader or to import all data into class objects when the program is started?

Some details

I'm creating a Java program for work, to assist with the check-in of employees since our current pen and paper system seems old and inefficient. The program would need to search for a particular employee when they arrive then would assign them to a location.

The question above pertains to getting the employee data (and probably location data now that I think about it). The amount of employees would probably be around 400, daily, and the data attributes would be stored in a .txt file and be along the lines of employee ID number, first name, last name, position.

Example

$ID: 1001, Fname: John, LName: Smith, Position: cashier


In the past I've used BufferedReader to great success when looking for particular data in a .txt file but due to the size and complexity (at least from my own programming perspective) of this program I thought I'd get some input.

Sidenote

Thanks for taking the time to look at this. I've been using StackOverflow for years now and haven't needed to personally ask a question until now since everything is asked and answered so well by everyone on here...

올바른 솔루션이 없습니다

다른 팁

I would load the text file lazily, i.e. when first used, but I would load it into a Map rather than search it linearly.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top