void (@NotNull List<PyImportStatementBase> result, @NotNull PyImportStatementBase oldImport, @NotNull Collection<? extends PyImportStatementBase> newImports) { final PyImportStatementBase topmostImport; if (myPySettings.OPTIMIZE_IMPORTS_SORT_IMPORTS) { topmostImport = Collections.min(newImports, AddImportHelper.getSameGroupImportsComparator(myFile)); } else { topmostImport = ContainerUtil.getFirstItem(newImports); } myNewImportToLineComments.putValues(topmostImport, myOldImportToLineComments.get(oldImport)); myNewImportToInnerComments.putValues(topmostImport, myOldImportToInnerComments.get(oldImport)); result.addAll(newImports); }