Please help. I seem to have done everything it has asked yet it wont let me pass the task
package com.codegym.task.task07.task0716;
import java.util.ArrayList;
/*
R or L
*/
public class Solution {
public static void main(String[] args) throws Exception {
ArrayList<String> list = new ArrayList<String>();
list.add("rose"); // 0
list.add("lyre"); // 1
list.add("love"); // 2
//list.add("love");
// list.add("slow");
list = fix(list);
for (String s : list) {
System.out.println(s);
}
}
public static ArrayList<String> fix(ArrayList<String> list) {
ArrayList<String> listOne = new ArrayList<String>();
// ArrayList<String> listTwo = new ArrayList<String>();
listOne.addAll(list);
for (int i = 0; i < list.size(); i++) {
String s = list.get(i);
boolean lBool = s.contains("l");
boolean rBool = s.contains("r");
if (rBool && !lBool) {
listOne.remove(i);
}
}
// listTwo.addAll(listOne);
for (int i = 0; i < listOne.size(); i++) {
String s = listOne.get(i);
boolean lBool = s.contains("l");
boolean rBool = s.contains("r");
if (lBool && !rBool) {
listOne.add(i+1, s);
i++;
}
}
return listOne;
}
}