my dog learned polymorphism
The moose likes Java in General and the fly likes Best data storage method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Best data storage method" Watch "Best data storage method" New topic

Best data storage method

saddsada dsdasda

Joined: Mar 20, 2006
Posts: 1
Hey, iv just got a simple problem what would be the best method for storing this type of data

list of words followed by a list of files the word is contained in e.g

"hello" ["a.txt","b.txt","c.txt"]
"ok" ["b.txt","d.txt"]
"yes" ["a.txt","b.txt"]

would i use hashset -hashmap or is it possible with arraylist

which i wish to add to this list when i find another word contained in a file so if the word is new then it gets added otherwise if i word contained in a file such as "ok" in "f.txt" it becomes

"hello" ["a.txt","b.txt","c.txt"]
"ok" ["b.txt","d.txt","f.txt"]
"yes" ["a.txt","b.txt"]

cheers in advance
Bimal Patel
Ranch Hand

Joined: Aug 29, 2003
Posts: 130

I think HashMap is a better solution. BTW, your nickname is not proper according to JavaRanch standards .

Work Hard, Expect The Worst...<br /> <br />Bimal R. Patel<br />(SCJP 1.2, SCWCD 1.4)
I agree. Here's the link:
subject: Best data storage method
It's not a secret anymore!