Merge branch 'patch/JAL-4311_import_pLDDT_scores_from_nonAlphaFold_sources' into...
[jalview.git] / src / jalview / datamodel / ContactMapHolder.java
index d80a719..3a64917 100644 (file)
@@ -3,6 +3,7 @@ package jalview.datamodel;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 
 import jalview.ws.datamodel.MappableContactMatrixI;
@@ -17,7 +18,8 @@ public class ContactMapHolder implements ContactMapHolderI
   {
     if (contactmaps != null && contactmaps.size() > 0)
     {
-      return contactmaps.values();
+      // defensive copy, and return non redundant set of ContactMatrixI instances
+      return new HashSet<ContactMatrixI>(contactmaps.values());
     }
     return Collections.EMPTY_LIST;
   }
@@ -32,9 +34,10 @@ public class ContactMapHolder implements ContactMapHolderI
     }
     if (cm instanceof MappableContactMatrixI)
     {
-      if (_aa.sequenceRef!=null)
+      if (_aa.sequenceRef != null)
       {
-        return ((MappableContactMatrixI)cm).getMappableContactList(_aa.sequenceRef, column);
+        return ((MappableContactMatrixI) cm)
+                .getMappableContactList(_aa.sequenceRef, column);
       }
     }
     // TODO: could resolve sequence position to column position here