Hello :)

Lets say I have a text file that looks like this :

*DataString1
info1;info2;info3
//newline delimiter
*DataString2
info1;info2;info3;info4
//newline delimiter
.
.
.
//and so on

What is the best container with which I could process and manipulate the information stored in this file?

Thank you for any info.

Joey

YOu haven't givenus much to go on... eg what kind of processing and manipulation...
but one obvious option is to define a small class with fields for info1/2/3 or whatever and methods for the processing/manipulation

Well first I thought to use arrays. Then I thought of using the set collection but I need to have duplicates inside. Maybe Maps or Lists?
For the manipulation part, I need to do some sorting on the DataString part and maybe have some logical comparisons on the info part of the file etc.
Basically I need to form collections from those DataString segments of the file. What collection should I use?

So you have multiple "datastrings" each of which has info1;info2;info3 values associated with it. Is that correct?
If so, definitely start with a small class that encapsulates a datastring and its associated infos. You can then put those objects into a static map with the datastring as key. That will get you off to a decent start.

So you have multiple "datastrings" each of which has info1;info2;info3 values associated with it. Is that correct?
If so, definitely start with a small class that encapsulates a datastring and its associated infos. You can then put those objects into a static map with the datastring as key. That will get you off to a decent start.

So static maps then eh? Okay, Im gonna head in that direction ASAP and report back if I run into some kind of trouble :)
Thank you very much mr. James!

Cheers, Joey

No, just one map, declared as static if it's in in the new class I recommended. The important thing is the class, not the collection.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.