[Biojava-l] Simple alignment
matthew_pocock at yahoo.co.uk
Mon Sep 15 11:33:11 EDT 2003
Emig, Robin wrote:
> Well, The problem is that the code in biojava is "safe", so it copies the Map first thing, but it copies it into a HashMap. So, since what I really need is the have the same order from an iterator that the file was read, all that needs to be done is to have all instances of HashMap in MSFAlignmentFormat, FastaAlignmentFormat and SimpleAlignment to be changed to LinkedHashMap. Then there should be no changes needed to any "interfaces". I think we should also have a unit test built to verify this as well.
I'm fairly sure that Map.clone() will do the sane thing. Cloning is
generally evil, but for collections they got so may bug reports that it
does work (or so they tell me). Any way, go ahead and diddle the
constructor guts so that it works for you. If you add the
order-preserving behavior to a unit test, update the javadocs on the
class to document the behavior as well.
More information about the Biojava-l