private ArrayList<String> list;
public void change()
{
String str = list.get(list.size() – 1);
for(int k = list.size() - 1; k > 0; k--)
list.set(k, list.get(k-1));
list.set(0, str);
}
Consider following replacements for the entire body of method change.
I. list.add(list.remove(0));
II. list.add(0, list.remove(list.size() – 1));
III. String str = list.get(0);
for(int k = 1; k < list.size() – 1; k++)
list.set(k, list.get(k+1));
list.set(list.size() -1, str);
Which of these replacements would result in an equivalent method?
Wähle eine der folgenden: