Some background
I have about 1000 objects of the same class that are created from parsing a text file. The class holds 4 short (~20 characters) Strings and 2 ints. I plan to make an application that uses these objects (a sort of map if it matters).

I would prefer not to have to parse the text file each time I execute the application. Is there some way to store the objects themselves or at least the information in the objects? I have looked a little at databases, but what I read talked about installing a driver and I need the application to run on multiple machines without installing additional software on them.

If parsing the text file each time is a problem, then can you create your own formatted file that does NOT require parsing but can be read and used to create the objects needed.

What are you trying to optimize?

I was under the (apparently mistaken) impression that going through 1-2k lines of text would take longer than one would want at the start of the application. I have only tested it with 10 lines to make sure everything works.

In terms of formatting, each object's data is on its own line, and each piece of data is ":" delimited. I am using split() to divide up each line. Is this acceptable or would you suggest some other formatting? What exactly do you mean by setting up a file that would not have to be parsed?

Thanks for the help.

The time reading any file will probably be the same if you have to parse it or if it is already parsed and you can more quickly build your objects.
Have you tried timing the read/parse time for a realistic sized file?

setting up a file that would not have to be parsed

A file that could be read and used to build your objects without parsing. I have no idea what you mean by parsing or how time consuming it is.

This article has been dead for over six months. Start a new discussion instead.