I need to instantiate a list with multiple String objects. I am not allowed to manually add objects 1 by 1.
I tried multiple ways, cannot get method to accept it.
scrambleOrRemove(["TAN", "ABRACADABRA", "WHOA", "APPLE", "EGGS"]);
Method:
public static void scrambleOrRemove(List<String> list)
{
int length = list.size()-1;
for(int i=0;i<length;i++)
{
String otherword = list.get(i);
if(scrambleWord(otherword).equals(otherword))
{
list.remove(i);
}
}
System.out.println(list);
}