Understanding Java Iterator
问题 If I run the following code, it will print out 3 times duplicate, but when I remove the if statement inside the while loop (just to see how many times it will iterate) it starts an infinite loop. How does actually this hasNext() method working? I thought that will iterate only 5 times as I have 5 items in the list. public class ExerciseOne { public static void main(String []args){ String []colors = {"MAGENTA","RED","WHITE","BLUE","CYAN"}; List<String> list = new ArrayList<String>(); for