JAL-3032 avoid assignments on the same line as synchronized
[jalview.git] / src / jalview / commands / EditCommand.java
index cac843f..b813dcf 100644 (file)
@@ -114,7 +114,7 @@ public class EditCommand implements CommandI
     public abstract Action getUndoAction();
   };
 
-  private List<Edit> edits = new ArrayList<Edit>();
+  private List<Edit> edits = new ArrayList<>();
 
   String description;
 
@@ -605,8 +605,8 @@ public class EditCommand implements CommandI
         // readd it to the alignment
         if (command.alIndex[i] < command.al.getHeight())
         {
-          List<SequenceI> sequences;
-          synchronized (sequences = command.al.getSequences())
+          List<SequenceI> sequences = command.al.getSequences();
+          synchronized (sequences)
           {
             if (!(command.alIndex[i] < 0))
             {
@@ -789,7 +789,7 @@ public class EditCommand implements CommandI
     if (modifyVisibility && !insert)
     {
       // only occurs if a sequence was added or deleted.
-      command.deletedAnnotationRows = new Hashtable<SequenceI, AlignmentAnnotation[]>();
+      command.deletedAnnotationRows = new Hashtable<>();
     }
     if (command.fullAlignmentHeight)
     {
@@ -948,7 +948,7 @@ public class EditCommand implements CommandI
 
     if (!insert)
     {
-      command.deletedAnnotations = new Hashtable<String, Annotation[]>();
+      command.deletedAnnotations = new Hashtable<>();
     }
 
     int aSize;
@@ -1138,7 +1138,7 @@ public class EditCommand implements CommandI
       return;
     }
 
-    List<SequenceFeature> oldsf = new ArrayList<SequenceFeature>();
+    List<SequenceFeature> oldsf = new ArrayList<>();
 
     int cSize = j - i;
 
@@ -1196,7 +1196,7 @@ public class EditCommand implements CommandI
 
     if (command.editedFeatures == null)
     {
-      command.editedFeatures = new Hashtable<SequenceI, List<SequenceFeature>>();
+      command.editedFeatures = new Hashtable<>();
     }
 
     command.editedFeatures.put(seq, oldsf);
@@ -1233,7 +1233,7 @@ public class EditCommand implements CommandI
    */
   public Map<SequenceI, SequenceI> priorState(boolean forUndo)
   {
-    Map<SequenceI, SequenceI> result = new HashMap<SequenceI, SequenceI>();
+    Map<SequenceI, SequenceI> result = new HashMap<>();
     if (getEdits() == null)
     {
       return result;
@@ -1266,7 +1266,7 @@ public class EditCommand implements CommandI
      * Work backwards through the edit list, deriving the sequences before each
      * was applied. The final result is the sequence set before any edits.
      */
-    Iterator<Edit> editList = new ReverseListIterator<Edit>(getEdits());
+    Iterator<Edit> editList = new ReverseListIterator<>(getEdits());
     while (editList.hasNext())
     {
       Edit oldEdit = editList.next();
@@ -1427,7 +1427,7 @@ public class EditCommand implements CommandI
     }
     else
     {
-      return new ReverseListIterator<Edit>(getEdits());
+      return new ReverseListIterator<>(getEdits());
     }
   }
 }