[Biojava-dev] HashMap ==> LinkedHashMap in HashSequenceDB
Matias Piipari
matias.piipari at gmail.com
Mon Nov 16 14:53:22 UTC 2009
Hello
I'd like to propose a change to org.biojava.bio.seq.db.HashSequenceDB: swap
the map implementation used to store the sequence-by-id map from HashMap to
LinkedHashMap. This would allow iterating the sequences in a defined order
(the order in which they were added to the map).
Best wishes
Matias
An example patch relative to rev 7059:
--- src/org/biojava/bio/seq/db/HashSequenceDB.java (revision 7059)
+++ src/org/biojava/bio/seq/db/HashSequenceDB.java (working copy)
@@ -22,8 +22,8 @@
package org.biojava.bio.seq.db;
import java.io.Serializable;
-import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
@@ -203,6 +203,6 @@
public HashSequenceDB(org.biojava.bio.seq.db.IDMaker idMaker, String
name) {
this.idMaker = idMaker;
this.name = name;
- this.sequenceByID = new HashMap();
+ this.sequenceByID = new LinkedHashMap();
}
}
More information about the biojava-dev
mailing list