This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes Files with data range Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Files with data range

Jacob Sonia
Ranch Hand

Joined: Jun 28, 2009
Posts: 164
I have a .txt file containing data in the form of
startrange,endrange,id

Now, this file has huge data like 1 million records.

I want that if someone gives me a number, i can lookup in this file to check if it falls in the range of startrange and endrange and return them the id. Now this can happen very often, so i would like to parse this beforehand in a datastructure and have it ready so one can just query the datastructure after that, or please suggest me the best approach.

I feel that i should have a stringtoken beforehand split for each line and look for the tokens in each line and keep the locid. Please guide.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Please UseOneThreadPerQuestion. Duplicate of this.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Files with data range
 
Similar Threads
Currency Converter in Java
Enum class using constants
ActionEvents/Swing Problem.
move randomly an object and to find its position
Which Datastructure to use