Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm implementing a hashtable structure for a dictionary. Dictionary is in a text file. There are 2 words on each line. I'm generating the hashtable by using the first word as a key. I'm holding the hashtable on a list. I want to save the hashtable to a text file to use it every time. What kind of structure should I use? Is there a way to do this without reading the whole hashtable from text file?

share|improve this question
The question doesn't make any sense. You're building a hashtable from a dictionary file - why do you need another file? – Ben Cottrell Apr 29 '12 at 15:11
to save the hashtable. – Rafaela Arcuri Apr 29 '12 at 15:16
up vote 1 down vote accepted

You are looking for serialization.

In Python you could use pickle. In Java you can do it too. Almost every language has techniques for serialization.

If your hashtable becomes too big, you will have to use a relational database management sysyem, like MySQL, PostgreSQL, Oracle, SQL Server, etc.

share|improve this answer
Binary serialization can be a big pain, particularly if objects change over time. This leaves us with textual serialization, which should be ... just a CSV file with two columns : key and value :) – Job Apr 29 '12 at 19:24
That's what I thought too, but maybe for some reason she doesn't want to read or write the CSV again. – Vitalij Zadneprovskij Apr 29 '12 at 19:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.