From 2f87d72ea4f1bbf768918a253be05771f9c430cb Mon Sep 17 00:00:00 2001 From: hansonr Date: Mon, 28 Jan 2019 21:03:15 -0600 Subject: [PATCH] iterators --- src/jalview/datamodel/Alignment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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(); -- 1.7.10.2