給定一個非空的ArrayList,迭代該列表時循環休息元素的最優雅方式是什麼?java.util.ArrayList通過循環內的休息元素循環
Give an ArrayList instance 'exampleList' contains five strings: ["A", "B", "C", "D", "E"]
,同時通過它循環:
for(String s : exampleList){
// when s is "A", I want to loop through "B"-"E", inside this loop
// when s is "B", I want to loop through "C"-"E", inside this loop
// when s is "C", I want to loop through "D"-"E", inside this loop
}