Speeding up Java Program
<p>Sorry for the non descriptive title, I couldn't think of a way to ask the question.</p>

<p>I wrote a java program which involves two long discrete processes.  The first creates a hashmap from a text file with about 400,000 lines; so as you can imagine this takes some time to do.  The thing is, this textfile never changes but I still have to generate the same hashmap every time the program runs.  Is there some way of getting around this.  Maybe using serialization or something to save this hashmap so that I can just use the already generated hashmap every time the program runs?</p>

<p>EDIT:
The text file maps strings to urls.  The first part of the program builds the map from the 400,000 line text file. The other part of the program reads from another text file and replaces every string it finds that is also in the hashmap with it's respective URL (this is another long process because I have to iterate the entire hashmap looking for strings at every line of the program).  Make sense?</p>

<p>EDIT 2 (per your request; a snippet of my code to populate the map):</p>

<pre><code>while( (line = mapFile.readLine() ) != null) {
    String string = "";
    String url = "";

    int i = 0;
    for(; line.charAt(i) != '\t'; i++) string += line.charAt(i);
    i++;
    for(; i &lt; line.length(); i++) url += line.charAt(i);

    methodMap.put(string, url);
}
</code></pre>

<p>Thanks.</p>
