currentSeq = currentSeq.createDatasetSequence();
}
}
- if (seqs.contains(currentSeq))
- {
- return;
- }
+
List<SequenceI> 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)
*/
public class LinkedIdentityHashSet<E> extends AbstractSet<E>
{
- LinkedHashMap<IdentityWrapper, IdentityWrapper> set = new LinkedHashMap<IdentityWrapper, IdentityWrapper>();
+ LinkedHashMap<IdentityWrapper, IdentityWrapper> set = new LinkedHashMap<>();
static class IdentityWrapper
{
@Override
public boolean equals(Object obj)
{
- return this.obj == obj;
+ return this.obj == ((IdentityWrapper) obj).obj;
}
@Override