I can't figure out why the last value of stringList (ie, Banana) is not being printed out or stored in arrayForTheList for that matter.
Given a list of Strings, return an array containing the same Strings in the same order
list2Array( ["Apple", "Orange", "Banana"] ) -> {"Apple", "Orange", "Banana"}
list2Array( ["Red", "Orange", "Yellow"] ) -> {"Red", "Orange", "Yellow"}
list2Array( ["Left", "Right", "Forward", "Back"] ) -> {"Left", "Right", "Forward", "Back"}
public String[] list2Array(List<String> stringList) {
String[] arrayForTheList = new String[(stringList.size())];
for (int i = 0; i < stringList.size() ; i++) {
arrayForTheList[i] = stringList.remove(0);
System.out.println(arrayForTheList[i]);
}
return arrayForTheList;
}