wood burning stoves*
The moose likes Java in General and the fly likes hashmap or other structure? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "hashmap or other structure?" Watch "hashmap or other structure?" New topic
Author

hashmap or other structure?

Fis Ka
Greenhorn

Joined: Sep 20, 2010
Posts: 1
hi folks,

I've been trying to come up with a solution, to a not-so-difficult-problem (maybe?). The issue is, that I want to index some files (actually quite many), but I want to store the vocabulary (set of unique terms) in the main memory with pointer to the db records, which in turn contain other information related to the terms in the vocab.

I would divide the problem/requirements as follows:

1.) I was thinking to use a hashmap, where the value is the term and the key is this pointer to db, one value can have many keys though, the keys in this case are document IDs.
2.) if 1), how scalable then this is? of course vocabulary cannot be that large, but there can exist lots of keys...
3.) How do I persist such hash map when I restart the program? I don't wanna start the indexing all-over again.
4.) Ignore all 3, there exist a better solution? I was thinking to store such terms in DB, and then read the db each time the program has started and recreate this hashmap, but how efficient this is (how fast will it work??)

thanks in advance,

Nik
Lino Larios
Greenhorn

Joined: Jun 27, 2008
Posts: 28
Hi i´m in the same situation , actually i´m using a hashmap ,the hash map its populated from a web service, so far i don´t have any problem related with the performance.

good luck
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hashmap or other structure?
 
Similar Threads
HashMap interview Question.
Pattern to handle complex validation
Create hashmap and dynamically populate
Sorting Keys(Value Objects) in HashMap
Retrieving different keys when the values in a hashmap are same???