From 8eb8ed34a9bbd66087433ca6a3d41b4fe2553d6a Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 1 Dec 2017 15:52:58 +0000 Subject: [PATCH] JAL-2792 sort feature attributes for output, not for storage --- src/jalview/datamodel/SequenceFeature.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/jalview/datamodel/SequenceFeature.java b/src/jalview/datamodel/SequenceFeature.java index 8a6cb61..34565c6 100755 --- a/src/jalview/datamodel/SequenceFeature.java +++ b/src/jalview/datamodel/SequenceFeature.java @@ -30,6 +30,7 @@ import jalview.util.StringUtils; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import java.util.SortedMap; import java.util.TreeMap; import java.util.Vector; @@ -643,9 +644,13 @@ public class SequenceFeature implements FeatureLocationI { /* * expand values in a Map attribute across separate lines + * copy to a TreeMap for alphabetical ordering */ - Map values = (Map) value; - for (Entry e : values.entrySet()) + Map values = (Map) value; + SortedMap sm = new TreeMap<>( + String.CASE_INSENSITIVE_ORDER); + sm.putAll(values); + for (Entry e : sm.entrySet()) { sb.append(String.format(ROW_DATA, key, e.getKey().toString(), e .getValue().toString())); -- 1.7.10.2