Saving data internally in Android messes up my data
===

I'm currently working on a game, where I need to create a transposition table for my AI. I implemented [`Hashtable`][1] so that the `key` to the Hashtable is a state under consideration and its corresponding `value` is the optimal next move.

However, when I save the Hashtable in Android's internal storage and restore it next time, it seems to have some saved data, but the `keys` (i.e. game states) are different than the `keys` I have saved in the previous instance.

Here is how I save and restore my data:

        private void readTranspositionTableFromFile() {
    	    FileInputStream fis = openFileInput(FILENAME);
    	    ObjectInputStream ois = new ObjectInputStream(fis);
    	    transpositionTable = (Hashtable<BoardState, NextMove>) ois.readObject();
    	    ois.close();
    	    deleteFile(FILENAME);
    	}
    	
    	private void writeTranspositionTableToFile() {
    	    FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
    	    ObjectOutputStream oos = new ObjectOutputStream(fos);
    	    oos.writeObject(transpositionTable);
    	    oos.close();
    	}

I see no problem in my `hashCode()` implementation, since it keeps returning same values for same states over and over.

I suspect saving/restoring the transposition table messes up my data because I logged the 2 runtimes and on the first one I got `hashCode()` to return 3964 and 3029 for the 2 states that were to be added to the table. However, while reading the table from file, the `hashCode()` returned 9119 twice.

Is there any problem in saving/restoring the data?

  [1]: http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Hashtable.html