From: kiramt Date: Fri, 2 Jun 2017 13:10:57 +0000 (+0100) Subject: JAL-2576 Proposed fix X-Git-Tag: Release_2_10_2~3^2~26^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bda14302200fc3bcfe66dc513bd030cba10a3681;p=jalview.git JAL-2576 Proposed fix --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 5d91b36..f5e6fc7 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1067,21 +1067,18 @@ public class Alignment implements AlignmentI currentSeq = currentSeq.createDatasetSequence(); } } - if (seqs.contains(currentSeq)) - { - return; - } + List toProcess = new ArrayList<>(); toProcess.add(currentSeq); while (toProcess.size() > 0) { // use a queue ? SequenceI curDs = toProcess.remove(0); - if (seqs.contains(curDs)) + + if (!seqs.add(curDs)) { continue; } - seqs.add(curDs); // iterate over database references, making sure we add forward referenced // sequences if (curDs.getDBRefs() != null) diff --git a/src/jalview/util/LinkedIdentityHashSet.java b/src/jalview/util/LinkedIdentityHashSet.java index bce540f..7f109ec 100644 --- a/src/jalview/util/LinkedIdentityHashSet.java +++ b/src/jalview/util/LinkedIdentityHashSet.java @@ -34,7 +34,7 @@ import java.util.LinkedHashMap; */ public class LinkedIdentityHashSet extends AbstractSet { - LinkedHashMap set = new LinkedHashMap(); + LinkedHashMap set = new LinkedHashMap<>(); static class IdentityWrapper { @@ -51,7 +51,7 @@ public class LinkedIdentityHashSet extends AbstractSet @Override public boolean equals(Object obj) { - return this.obj == obj; + return this.obj == ((IdentityWrapper) obj).obj; } @Override