JAL-3383 JAL-3253-applet Java8 switches to clarify ViewportRanges
[jalview.git] / src / jalview / datamodel / Alignment.java
index 1956df7..91b29da 100755 (executable)
@@ -125,8 +125,7 @@ public class Alignment implements AlignmentI
   /**
    * Make a new alignment from an array of SeqCigars
    * 
-   * @param seqs
-   *          SeqCigar[]
+   * @param alseqs
    */
   public Alignment(SeqCigar[] alseqs)
   {
@@ -399,6 +398,10 @@ public class Alignment implements AlignmentI
     return null;
   }
 
+  private static final SequenceGroup[] noGroups = new SequenceGroup[0];
+
+  private ArrayList<SequenceGroup> temp = new ArrayList<>();
+
   /*
    * (non-Javadoc)
    * 
@@ -408,11 +411,15 @@ public class Alignment implements AlignmentI
   @Override
   public SequenceGroup[] findAllGroups(SequenceI s)
   {
-    ArrayList<SequenceGroup> temp = new ArrayList<>();
 
     synchronized (groups)
     {
+      temp.clear();
       int gSize = groups.size();
+      if (gSize == 0)
+      {
+        return noGroups;
+      }
       for (int i = 0; i < gSize; i++)
       {
         SequenceGroup sg = groups.get(i);