What is the output of the Java code below?
„`
List<String> list = new ArrayList<>(List.of(„a“, „b“, „c“));
list.stream().map(s -> {
list.add(„x“);
return s.toUpperCase();
}).forEach(System.out::println);
„`
/**
-
A B C
-
ConcurrentModificationException
-
Infinite loop
-
Compilation error
**/
Link to the solution and explanation:
https://javabulletin.substack.com/p/list-fail-fast-behavior-quiz
submitted by /u/Educational-Ad2036
[link] [comments]