From: hansonr Date: Tue, 29 Jan 2019 03:03:15 +0000 (-0600) Subject: iterators X-Git-Tag: Release_2_11_4_0~45^2~18^2~278 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2f87d72ea4f1bbf768918a253be05771f9c430cb;p=jalview.git iterators --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 93ad332..300c950 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -195,6 +195,7 @@ public class Alignment implements AlignmentI { synchronized (sequences) { + if (i > -1 && i < sequences.size()) { return sequences.get(i); @@ -589,11 +590,12 @@ public class Alignment implements AlignmentI int i = 0; SequenceI sq = null; String sqname = null; + int nseq = sequences.size(); if (startAfter != null) { // try to find the sequence in the alignment boolean matched = false; - while (i < sequences.size()) + while (i < nseq) { if (getSequenceAt(i++) == startAfter) { @@ -606,7 +608,7 @@ public class Alignment implements AlignmentI i = 0; } } - while (i < sequences.size()) + while (i < nseq) { sq = getSequenceAt(i); sqname = sq.getName();