Danilo sent us an interesting Java-Quiz from the Java Specialists’ Newsletter created by Olivier Croisier. You have to insert your corrective code in place of the //FIXME comment, following these instructions:

  1. Do not modify his existing code, it’s Perfect (of course).
  2. The FIXME tag shows where you’re allowed to insert your corrective code
  3. He must be able to understand your solution when he comes back (so using Reflection is not an option).

Can you find a solution for it?

final List<String> list = new ArrayList() {{ 
      add("Hello"); 
}};
final Iterator<String> iterator = list.iterator();
System.out.println(iterator.next());
list.add("World");
// FIXME : work here while I'm sunbathing
System.out.println(iterator.next());

Later I’ll post my attempt to solve it.