public static ArrayList<String> fix(ArrayList<String> strings) { Iterator<String> iterator = strings.iterator(); while(iterator.hasNext()) { String string = iterator.next(); if (!string.contains("л") && string.contains("р")) { iterator.remove(); } else if (string.contains("л") && !string.contains("р")) { String string2 = string.replace("л", "лл"); int index = strings.indexOf(string); if (index != -1) { strings.set(index, string2); } } } return strings; }