Sort the mappings prior to writing the map file to enhance map file

stability wrt diffing.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1756 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-09-26 02:08:47 +00:00
parent 3ed25c9bce
commit 4e9acda18d
@@ -1,5 +1,5 @@
//
// $Id: MapFileTileSetIDBroker.java,v 1.6 2002/09/23 18:53:01 mdb Exp $
// $Id: MapFileTileSetIDBroker.java,v 1.7 2002/09/26 02:08:47 mdb Exp $
package com.threerings.media.tile.tools;
@@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.Iterator;
import com.samskivert.io.PersistenceException;
import com.samskivert.util.QuickSort;
import com.threerings.media.tile.TileSetIDBroker;
@@ -143,12 +144,16 @@ public class MapFileTileSetIDBroker implements TileSetIDBroker
public static void writeMapFile (BufferedWriter bout, HashMap map)
throws IOException
{
String[] lines = new String[map.size()];
Iterator iter = map.keySet().iterator();
while (iter.hasNext()) {
for (int ii = 0; iter.hasNext(); ii++) {
String key = (String)iter.next();
Integer value = (Integer)map.get(key);
String line = key + SEP_STR + value;
bout.write(line, 0, line.length());
lines[ii] = key + SEP_STR + value;
}
QuickSort.sort(lines);
for (int ii = 0; ii < lines.length; ii++) {
bout.write(lines[ii], 0, lines[ii].length());
bout.newLine();
}
bout.flush();