diff src/org/tmatesoft/hg/repo/HgDataFile.java @ 79:5f9635c01681

TreeMap are more effective when keys are unique
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 25 Jan 2011 02:26:06 +0100
parents c25c5c348d1b
children 61eedab3eb3e
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgDataFile.java	Tue Jan 25 02:13:53 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgDataFile.java	Tue Jan 25 02:26:06 2011 +0100
@@ -20,7 +20,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
+import java.util.TreeMap;
 
 import org.tmatesoft.hg.core.Nodeid;
 import org.tmatesoft.hg.core.Path;
@@ -192,8 +192,8 @@
 
 	private static class Metadata {
 		// XXX sparse array needed
-		private final HashMap<Integer, Integer> offsets = new HashMap<Integer, Integer>(5);
-		private final HashMap<Integer, MetadataEntry[]> entries = new HashMap<Integer, MetadataEntry[]>(5);
+		private final TreeMap<Integer, Integer> offsets = new TreeMap<Integer, Integer>();
+		private final TreeMap<Integer, MetadataEntry[]> entries = new TreeMap<Integer, MetadataEntry[]>();
 		boolean known(int revision) {
 			return offsets.containsKey(revision);
 		}